Example usage for org.eclipse.jface.viewers ComboViewer ComboViewer

List of usage examples for org.eclipse.jface.viewers ComboViewer ComboViewer

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ComboViewer ComboViewer.

Prototype

public ComboViewer(Composite parent, int style) 

Source Link

Document

Creates a combo viewer on a newly-created combo control under the given parent.

Usage

From source file:com.netxforge.netxstudio.screens.f3.ValueRangeSelectionComponent.java

License:Open Source License

public void buildUI(Composite parent, Object layoutData) {

    cmpValueRange = toolkit.createComposite(parent, showBorder ? SWT.BORDER : SWT.NONE);

    toolkit.adapt(cmpValueRange);//from  w  ww.  j a va 2  s  . c o m

    if (layoutData != null) {
        cmpValueRange.setLayoutData(layoutData);
    }

    GridLayout periodGridLayout = new GridLayout();
    periodGridLayout.numColumns = 2;
    cmpValueRange.setLayout(periodGridLayout);

    Label createLabel = toolkit.createLabel(cmpValueRange, "Select the range: ");
    createLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    cmbViewerValueRange = new ComboViewer(cmpValueRange, SWT.READ_ONLY);
    cmbViewerValueRange.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    toolkit.paintBordersFor(cmbViewerValueRange.getCombo());
}

From source file:com.netxforge.netxstudio.screens.f4.NewEditJob.java

License:Open Source License

private void buildUI() {
    setLayout(new FillLayout(SWT.HORIZONTAL));

    frmNewJob = toolkit.createForm(this);
    frmNewJob.setSeparatorVisible(true);
    toolkit.paintBordersFor(frmNewJob);//  w ww .  ja  v  a  2 s  .  com
    frmNewJob.getBody().setLayout(new FormLayout());

    Section sctnDetails = toolkit.createSection(frmNewJob.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    FormData fd_sctnDetails = new FormData();
    fd_sctnDetails.top = new FormAttachment(0, 12);
    fd_sctnDetails.left = new FormAttachment(0, 12);
    sctnDetails.setLayoutData(fd_sctnDetails);
    toolkit.paintBordersFor(sctnDetails);
    sctnDetails.setText("Job Details");

    Composite compositeDetails = toolkit.createComposite(sctnDetails, SWT.NONE);
    toolkit.paintBordersFor(compositeDetails);
    sctnDetails.setClient(compositeDetails);
    compositeDetails.setLayout(new GridLayout(2, false));

    btnActive = toolkit.createButton(compositeDetails, "Active", SWT.CHECK);
    btnActive.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));

    Label lblJobName = toolkit.createLabel(compositeDetails, "Name:", SWT.NONE);
    lblJobName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblJobName.setAlignment(SWT.RIGHT);

    txtJobName = toolkit.createText(compositeDetails, "New Text", SWT.NONE);
    txtJobName.setText("");
    GridData gd_txtJobName = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gd_txtJobName.widthHint = 100;
    txtJobName.setLayoutData(gd_txtJobName);

    // SECTION START OF JOB

    Section sctnRecurrence = toolkit.createSection(frmNewJob.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    fd_sctnDetails.right = new FormAttachment(sctnRecurrence, -6);
    FormData fd_sctnRecurrence = new FormData();
    fd_sctnRecurrence.right = new FormAttachment(100, -12);
    fd_sctnRecurrence.left = new FormAttachment(0, 295);
    fd_sctnRecurrence.bottom = new FormAttachment(0, 129);
    fd_sctnRecurrence.top = new FormAttachment(0, 12);
    sctnRecurrence.setLayoutData(fd_sctnRecurrence);
    toolkit.paintBordersFor(sctnRecurrence);
    sctnRecurrence.setText("Start");

    Composite compositeRecurrence = toolkit.createComposite(sctnRecurrence, SWT.NONE);
    toolkit.paintBordersFor(compositeRecurrence);
    sctnRecurrence.setClient(compositeRecurrence);
    compositeRecurrence.setLayout(new GridLayout(6, false));

    Label lblOn = toolkit.createLabel(compositeRecurrence, "On:", SWT.NONE);
    lblOn.setAlignment(SWT.RIGHT);
    GridData gd_lblOn = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblOn.widthHint = 70;
    lblOn.setLayoutData(gd_lblOn);

    comboViewerOn = new ComboViewer(compositeRecurrence, SWT.NONE);
    Combo comboOn = comboViewerOn.getCombo();
    GridData gd_comboOn = new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1);
    gd_comboOn.widthHint = 150;
    comboOn.setLayoutData(gd_comboOn);
    toolkit.paintBordersFor(comboOn);

    Label lblAt = toolkit.createLabel(compositeRecurrence, "At:", SWT.NONE);
    lblAt.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    cdateTimeStartTime = new CDateTime(compositeRecurrence, CDT.BORDER | CDT.CLOCK_24_HOUR | CDT.DROP_DOWN);
    GridData gd_cdateTimeStartTime = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gd_cdateTimeStartTime.widthHint = 150;
    cdateTimeStartTime.setLayoutData(gd_cdateTimeStartTime);
    cdateTimeStartTime.setPattern("HH:mm");

    toolkit.adapt(cdateTimeStartTime);
    toolkit.paintBordersFor(cdateTimeStartTime);

    Label lblEvery = toolkit.createLabel(compositeRecurrence, "Every:", SWT.NONE);
    lblEvery.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblEvery.setAlignment(SWT.RIGHT);

    comboViewerEvery = new ComboViewer(compositeRecurrence, SWT.NONE);
    Combo comboEvery = comboViewerEvery.getCombo();
    GridData gd_comboEvery = new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1);
    gd_comboEvery.widthHint = 150;
    comboEvery.setLayoutData(gd_comboEvery);
    toolkit.paintBordersFor(comboEvery);
    new Label(compositeRecurrence, SWT.NONE);
    new Label(compositeRecurrence, SWT.NONE);

    Label lblStartsOn = toolkit.createLabel(compositeRecurrence, "From:", SWT.NONE);
    GridData gd_lblStartsOn = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblStartsOn.widthHint = 70;
    lblStartsOn.setLayoutData(gd_lblStartsOn);
    lblStartsOn.setAlignment(SWT.RIGHT);

    dateChooserStartsOn = new DateChooserCombo(compositeRecurrence, SWT.BORDER | SWT.FLAT);
    GridData gd_dateChooserStartsOn = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
    gd_dateChooserStartsOn.heightHint = 19;
    gd_dateChooserStartsOn.widthHint = 150;
    dateChooserStartsOn.setLayoutData(gd_dateChooserStartsOn);
    toolkit.adapt(dateChooserStartsOn);
    toolkit.paintBordersFor(dateChooserStartsOn);
    new Label(compositeRecurrence, SWT.NONE);
    new Label(compositeRecurrence, SWT.NONE);

    // SECTION END OF JOB

    Section sctnJobEnd = toolkit.createSection(frmNewJob.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    FormData fd_sctnJobEnd = new FormData();
    fd_sctnJobEnd.top = new FormAttachment(sctnRecurrence, 12);
    fd_sctnJobEnd.left = new FormAttachment(0, 295);
    fd_sctnJobEnd.right = new FormAttachment(100, -12);
    sctnJobEnd.setLayoutData(fd_sctnJobEnd);
    toolkit.paintBordersFor(sctnJobEnd);
    sctnJobEnd.setText("End");
    sctnJobEnd.setExpanded(true);

    Composite compositeEndsOn = toolkit.createComposite(sctnJobEnd, SWT.NONE);
    toolkit.paintBordersFor(compositeEndsOn);
    sctnJobEnd.setClient(compositeEndsOn);
    compositeEndsOn.setLayout(new GridLayout(3, false));

    btnOn = toolkit.createButton(compositeEndsOn, "On: ", SWT.RADIO);
    // btnOn.addSelectionListener(new SelectionAdapter() {
    // @Override
    // public void widgetSelected(SelectionEvent e) {
    //
    // }
    // });

    GridData gd_btnOn = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnOn.widthHint = 70;
    btnOn.setLayoutData(gd_btnOn);

    dateChooserEndsOn = new DateChooserCombo(compositeEndsOn, SWT.BORDER | SWT.FLAT);
    GridData gd_dateChooserEndsOn = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dateChooserEndsOn.heightHint = 19;
    gd_dateChooserEndsOn.widthHint = 150;
    dateChooserEndsOn.setLayoutData(gd_dateChooserEndsOn);
    toolkit.adapt(dateChooserEndsOn);
    toolkit.paintBordersFor(dateChooserEndsOn);

    btnAfter = toolkit.createButton(compositeEndsOn, "After:", SWT.RADIO);

    txtOccurences = toolkit.createText(compositeEndsOn, "New Text", SWT.NONE);
    GridData gd_txtOccurences = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gd_txtOccurences.widthHint = 15;
    txtOccurences.setLayoutData(gd_txtOccurences);
    txtOccurences.setText("");

    toolkit.createLabel(compositeEndsOn, "Repeats", SWT.NONE);

    btnNever = toolkit.createButton(compositeEndsOn, "Never", SWT.RADIO);
    btnNever.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    new Label(compositeEndsOn, SWT.NONE);
    btnNever.setSelection(true);

    // SECTION SUMMARY

    Section sctnSummary = toolkit.createSection(frmNewJob.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    fd_sctnDetails.bottom = new FormAttachment(sctnSummary, -12);
    fd_sctnJobEnd.bottom = new FormAttachment(sctnSummary, -12);
    FormData fd_sctnSummary = new FormData();
    fd_sctnSummary.top = new FormAttachment(0, 260);
    fd_sctnSummary.bottom = new FormAttachment(100, -12);
    fd_sctnSummary.left = new FormAttachment(0, 12);
    fd_sctnSummary.right = new FormAttachment(100, -12);
    sctnSummary.setLayoutData(fd_sctnSummary);
    toolkit.paintBordersFor(sctnSummary);
    sctnSummary.setText("Summary");

    Composite composite_3 = toolkit.createComposite(sctnSummary, SWT.NONE);
    toolkit.paintBordersFor(composite_3);
    sctnSummary.setClient(composite_3);
    composite_3.setLayout(new GridLayout(1, false));

    occurencesTableViewer = new TableViewer(composite_3, SWT.BORDER | SWT.FULL_SELECTION);
    table = occurencesTableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
    toolkit.paintBordersFor(table);

    TableViewerColumn tableViewerColumn = new TableViewerColumn(occurencesTableViewer, SWT.NONE);
    TableColumn tblclmnDate = tableViewerColumn.getColumn();
    tblclmnDate.setWidth(100);
    tblclmnDate.setText("Date");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(occurencesTableViewer, SWT.NONE);
    TableColumn tblclmnTime = tableViewerColumn_1.getColumn();
    tblclmnTime.setWidth(100);
    tblclmnTime.setText("Time");

    occurencesTableViewer.setContentProvider(new ArrayContentProvider());
    occurencesTableViewer.setLabelProvider(new OccurenceLabelProvider());

    tableViewerJobObjects = new TableViewer(compositeDetails, SWT.BORDER | SWT.FULL_SELECTION);
    tableJobObjects = tableViewerJobObjects.getTable();
    tableJobObjects.setHeaderVisible(true);
    tableJobObjects.setLinesVisible(true);
    tableJobObjects.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    toolkit.paintBordersFor(tableJobObjects);

    TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewerJobObjects, SWT.NONE);
    TableColumn tblclmnObject = tableViewerColumn_2.getColumn();
    tblclmnObject.setWidth(135);
    tblclmnObject.setText("Object");

    TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tableViewerJobObjects, SWT.NONE);
    TableColumn tblclmnId = tableViewerColumn_3.getColumn();
    tblclmnId.setWidth(120);
    tblclmnId.setText("ID");
}

From source file:com.netxforge.netxstudio.screens.f4.NewEditMappingColumn.java

License:Open Source License

private void buildDataMappingOptions(Composite cmpColumnMapping) {
    btnMetricValue = toolkit.createButton(cmpColumnMapping, "Metric Value", SWT.RADIO);
    new Label(cmpColumnMapping, SWT.NONE);

    hprlnkSelectMetric = toolkit.createHyperlink(cmpColumnMapping, "Select Metric", SWT.NONE);
    hprlnkSelectMetric.addHyperlinkListener(new IHyperlinkListener() {
        public void linkActivated(HyperlinkEvent e) {

            Resource unitResource = editingService.getData(MetricsPackage.Literals.METRIC);
            MetricFilterDialog dialog = new MetricFilterDialog(NewEditMappingColumn.this.getShell(),
                    unitResource);/*from   w  w w  . ja v a2s.c  o  m*/
            if (dialog.open() == IDialogConstants.OK_ID) {
                Metric metric = (Metric) dialog.getFirstResult();
                if (mxlsColumn.getDataType() instanceof ValueDataKind) {
                    ValueDataKind vdk = (ValueDataKind) mxlsColumn.getDataType();
                    vdk.setMetricRef(metric);
                    context.updateTargets();
                }
            }
        }

        public void linkEntered(HyperlinkEvent e) {
        }

        public void linkExited(HyperlinkEvent e) {
        }
    });
    toolkit.paintBordersFor(hprlnkSelectMetric);

    txtMetric = toolkit.createText(cmpColumnMapping, "New Text", SWT.READ_ONLY);
    txtMetric.setText("");
    txtMetric.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    cmbViewrMetricKindHint = new ComboViewer(cmpColumnMapping, SWT.NONE);
    cmbMetricHint = cmbViewrMetricKindHint.getCombo();
    cmbMetricHint.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    toolkit.paintBordersFor(cmbMetricHint);
}

From source file:com.netxforge.netxstudio.screens.nf3.Retention.java

License:Open Source License

private void addUIRule(final Composite cmpRules, final MetricRetentionRule rule, EMFDataBindingContext context,
        IEMFValueProperty retentionPeriodProperty, IValueProperty cmbSelectionProperty) {

    final Label lblMonthlyValues = toolkit.createLabel(cmpRules, rule.getName(), SWT.NONE);
    lblMonthlyValues.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    final ComboViewer cmbViewerTarget = new ComboViewer(cmpRules, SWT.NONE);
    Combo cmbMonthly = cmbViewerTarget.getCombo();
    GridData gd_cmbMonthly = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gd_cmbMonthly.widthHint = 150;/* w w  w.ja v a2  s  . co  m*/
    cmbMonthly.setLayoutData(gd_cmbMonthly);
    toolkit.paintBordersFor(cmbMonthly);

    cmbMonthly.setFocus();

    final ImageHyperlink mghprlnkEditRetentionExpression = toolkit.createImageHyperlink(cmpRules, SWT.NONE);
    mghprlnkEditRetentionExpression.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
    mghprlnkEditRetentionExpression.addHyperlinkListener(new HyperlinkAdapter() {
        public void linkActivated(HyperlinkEvent e) {
            launchExpressionScreen(rule);
        }
    });
    toolkit.paintBordersFor(mghprlnkEditRetentionExpression);
    mghprlnkEditRetentionExpression.setText("Edit retention expression");

    cmbViewerTarget.setContentProvider(new ArrayContentProvider());
    cmbViewerTarget.setLabelProvider(new LabelProvider());
    cmbViewerTarget.setInput(MetricRetentionPeriod.values());

    context.bindValue(cmbSelectionProperty.observe(cmbViewerTarget), retentionPeriodProperty.observe(rule));
}

From source file:com.netxforge.netxstudio.screens.nf3.Retention.java

License:Open Source License

private void addCustomUIRule(final Composite cmpRules, final MetricRetentionRule rule,
        EMFDataBindingContext context, IEMFValueProperty retentionPeriodProperty,
        IValueProperty cmbSelectionProperty) {

    // Edit the name of the rule.
    final Text nameText = toolkit.createText(cmpRules, "");
    GridData textLayoutData = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    textLayoutData.widthHint = 100;/*from w ww. j  av a 2  s  . com*/
    nameText.setLayoutData(textLayoutData);

    nameText.setFocus();

    final ISWTObservableValue observeTextName = SWTObservables.observeDelayedValue(400,
            SWTObservables.observeText(nameText, SWT.Modify));

    final IEMFEditValueProperty nameProperty = EMFEditProperties.value(editingService.getEditingDomain(),
            MetricsPackage.Literals.METRIC_RETENTION_RULE__NAME);

    context.bindValue(observeTextName, nameProperty.observe(rule));

    // Edit the interval.
    final Text intervalText = toolkit.createText(cmpRules, "");
    final GridData intervalGridData = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    intervalText.setLayoutData(intervalGridData);

    final ISWTObservableValue observeTextInterval = SWTObservables.observeDelayedValue(400,
            SWTObservables.observeText(intervalText, SWT.Modify));

    final IEMFEditValueProperty intervalModelProperty = EMFEditProperties.value(
            editingService.getEditingDomain(), MetricsPackage.Literals.METRIC_RETENTION_RULE__INTERVAL_HINT);

    context.bindValue(observeTextInterval, intervalModelProperty.observe(rule));

    // Edit the retention period.
    final ComboViewer cmbViewerTarget = new ComboViewer(cmpRules, SWT.NONE);
    final Combo cmbRetentionPeriod = cmbViewerTarget.getCombo();
    final GridData gridDataRetentionPeriod = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gridDataRetentionPeriod.widthHint = 150;
    cmbRetentionPeriod.setLayoutData(gridDataRetentionPeriod);
    toolkit.paintBordersFor(cmbRetentionPeriod);

    final ImageHyperlink mghprlnkEditRetentionExpression = toolkit.createImageHyperlink(cmpRules, SWT.NONE);
    mghprlnkEditRetentionExpression.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
    mghprlnkEditRetentionExpression.addHyperlinkListener(new HyperlinkAdapter() {
        public void linkActivated(HyperlinkEvent e) {
            launchExpressionScreen(rule);
        }
    });
    toolkit.paintBordersFor(mghprlnkEditRetentionExpression);
    mghprlnkEditRetentionExpression.setText("Edit retention expression");

    final ImageHyperlink removeObjectHyperLink = toolkit.createImageHyperlink(cmpRules, SWT.NONE);
    removeObjectHyperLink.addHyperlinkListener(new HyperlinkAdapter() {
        public void linkActivated(HyperlinkEvent e) {

            final CompoundCommand cc = new CompoundCommand();

            if (rule.eIsSet(MetricsPackage.Literals.METRIC_RETENTION_RULE__RETENTION_EXPRESSION)) {
                final Expression retentionExpression = rule.getRetentionExpression();
                final Command deleteExpressionCommand = DeleteCommand.create(editingService.getEditingDomain(),
                        retentionExpression);
                cc.append(deleteExpressionCommand);
            }
            final Command deleteRuleCommand = DeleteCommand.create(editingService.getEditingDomain(), rule);
            cc.append(deleteRuleCommand);
            editingService.getEditingDomain().getCommandStack().execute(cc);
        }
    });

    final GridData removeObjectGridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    removeObjectGridData.widthHint = 18;
    removeObjectHyperLink.setLayoutData(removeObjectGridData);
    removeObjectHyperLink
            .setImage(ResourceManager.getPluginImage("org.eclipse.ui", "/icons/full/etool16/delete.gif"));
    toolkit.paintBordersFor(removeObjectHyperLink);
    removeObjectHyperLink.setText("");

    cmbViewerTarget.setContentProvider(new ArrayContentProvider());
    cmbViewerTarget.setLabelProvider(new LabelProvider());
    cmbViewerTarget.setInput(MetricRetentionPeriod.values());

    context.bindValue(cmbSelectionProperty.observe(cmbViewerTarget), retentionPeriodProperty.observe(rule));

}

From source file:com.netxforge.netxstudio.screens.nf4.NewEditUser.java

License:Open Source License

private void buildUI() {
    setLayout(new FillLayout(SWT.HORIZONTAL));

    frmNewEditUser = toolkit.createForm(this);
    frmNewEditUser.setSeparatorVisible(true);
    toolkit.paintBordersFor(frmNewEditUser);

    String title = ScreenUtil.isNewOperation(getOperation()) ? "New: " : "Edit: ";

    frmNewEditUser.setText(title + "User");
    frmNewEditUser.addMessageHyperlinkListener(new HyperlinkAdapter());
    frmNewEditUser.getBody().setLayout(new FormLayout());

    Section sctnInfo = toolkit.createSection(frmNewEditUser.getBody(), Section.EXPANDED | Section.TITLE_BAR);
    FormData fd_sctnInfo = new FormData();
    fd_sctnInfo.top = new FormAttachment(0, 12);
    fd_sctnInfo.bottom = new FormAttachment(0, 169);
    fd_sctnInfo.right = new FormAttachment(100, -12);
    fd_sctnInfo.left = new FormAttachment(0, 12);
    sctnInfo.setLayoutData(fd_sctnInfo);
    toolkit.paintBordersFor(sctnInfo);//  w w  w  .  j  a  va2 s  . co m
    sctnInfo.setText("Info");

    Composite composite_1 = toolkit.createComposite(sctnInfo, SWT.NONE);
    toolkit.paintBordersFor(composite_1);
    sctnInfo.setClient(composite_1);
    GridLayout gl_composite_1 = new GridLayout(2, false);
    gl_composite_1.horizontalSpacing = 8;
    composite_1.setLayout(gl_composite_1);

    Label lblLogin = toolkit.createLabel(composite_1, "Login:", SWT.NONE);
    lblLogin.setAlignment(SWT.RIGHT);
    GridData gd_lblLogin = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblLogin.widthHint = 70;
    lblLogin.setLayoutData(gd_lblLogin);

    txtLogin = toolkit.createText(composite_1, "New Text", SWT.NONE);
    txtLogin.setText("");
    GridData gd_txtLogin = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
    gd_txtLogin.widthHint = 200;
    txtLogin.setLayoutData(gd_txtLogin);

    Label lblFirstName = toolkit.createLabel(composite_1, "First Name:", SWT.NONE);
    lblFirstName.setAlignment(SWT.RIGHT);
    GridData gd_lblFirstName = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblFirstName.widthHint = 70;
    lblFirstName.setLayoutData(gd_lblFirstName);

    txtFirstName = toolkit.createText(composite_1, "New Text", SWT.NONE);
    GridData gd_txtFirstName = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtFirstName.widthHint = 200;
    txtFirstName.setLayoutData(gd_txtFirstName);
    txtFirstName.setText("");

    Label lblLastName = toolkit.createLabel(composite_1, "Last Name:", SWT.NONE);
    lblLastName.setAlignment(SWT.RIGHT);
    GridData gd_lblLastName = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblLastName.widthHint = 70;
    lblLastName.setLayoutData(gd_lblLastName);

    txtLastName = toolkit.createText(composite_1, "New Text", SWT.NONE);
    txtLastName.setText("");
    GridData gd_txtLastName = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtLastName.widthHint = 200;
    txtLastName.setLayoutData(gd_txtLastName);

    Label lblEmail = toolkit.createLabel(composite_1, "Email:", SWT.NONE);
    lblEmail.setAlignment(SWT.RIGHT);
    GridData gd_lblEmail = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblEmail.widthHint = 70;
    lblEmail.setLayoutData(gd_lblEmail);

    FormattedText formattedText = new FormattedText(composite_1, SWT.BORDER | SWT.NONE);
    txtEmail = formattedText.getControl();
    GridData gd_txtEmail = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtEmail.widthHint = 200;
    txtEmail.setLayoutData(gd_txtEmail);
    new Label(composite_1, SWT.NONE);

    btnCheck = toolkit.createButton(composite_1, "Active?", SWT.CHECK);

    // The Authentication section, in edit mode should ask to reset the
    // password,
    // as the set password will not be shown.

    Section sctnAuthentication = toolkit.createSection(frmNewEditUser.getBody(),
            Section.EXPANDED | Section.TREE_NODE | Section.TITLE_BAR);
    FormData fd_sctnAuthentication = new FormData();
    fd_sctnAuthentication.top = new FormAttachment(sctnInfo, 12);
    fd_sctnAuthentication.right = new FormAttachment(100, -12);
    fd_sctnAuthentication.left = new FormAttachment(0, 12);
    sctnAuthentication.setLayoutData(fd_sctnAuthentication);
    toolkit.paintBordersFor(sctnAuthentication);
    sctnAuthentication.setText("Authentication");

    Composite composite_2 = toolkit.createComposite(sctnAuthentication, SWT.NONE);
    toolkit.paintBordersFor(composite_2);
    sctnAuthentication.setClient(composite_2);
    composite_2.setLayout(new GridLayout(2, false));

    Label lblPassword = toolkit.createLabel(composite_2, "Password:", SWT.NONE);
    lblPassword.setAlignment(SWT.RIGHT);
    GridData gd_lblPassword = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblPassword.widthHint = 70;
    lblPassword.setLayoutData(gd_lblPassword);

    txtPass = toolkit.createText(composite_2, "New Text", SWT.PASSWORD);
    GridData gd_txtPass = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtPass.widthHint = 200;
    txtPass.setLayoutData(gd_txtPass);
    txtPass.setText("");

    Label lblConfirm = toolkit.createLabel(composite_2, "Confirm:", SWT.NONE);
    lblConfirm.setAlignment(SWT.RIGHT);
    lblConfirm.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

    txtConfirm = toolkit.createText(composite_2, "New Text", SWT.PASSWORD);
    GridData gd_txtConfirm = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtConfirm.widthHint = 200;
    txtConfirm.setLayoutData(gd_txtConfirm);
    txtConfirm.setText("");

    Section sctnRoles = toolkit.createSection(frmNewEditUser.getBody(), Section.TITLE_BAR);
    fd_sctnAuthentication.bottom = new FormAttachment(sctnRoles, -12);
    FormData fd_sctnRoles = new FormData();
    fd_sctnRoles.top = new FormAttachment(0, 280);
    fd_sctnRoles.bottom = new FormAttachment(100, -12);
    fd_sctnRoles.right = new FormAttachment(100, -12);
    fd_sctnRoles.left = new FormAttachment(sctnAuthentication, 0, SWT.LEFT);
    sctnRoles.setLayoutData(fd_sctnRoles);
    toolkit.paintBordersFor(sctnRoles);
    sctnRoles.setText("Role");

    Composite composite_3 = toolkit.createComposite(sctnRoles, SWT.NONE);
    toolkit.paintBordersFor(composite_3);
    sctnRoles.setClient(composite_3);
    composite_3.setLayout(new GridLayout(2, false));

    Label lblRole = toolkit.createLabel(composite_3, "Role:", SWT.NONE);
    lblRole.setAlignment(SWT.RIGHT);
    GridData gd_lblRole = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblRole.widthHint = 70;
    lblRole.setLayoutData(gd_lblRole);

    comboViewer = new ComboViewer(composite_3, SWT.READ_ONLY);
    combo = comboViewer.getCombo();
    GridData gd_combo = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
    gd_combo.widthHint = 200;
    combo.setLayoutData(gd_combo);
    toolkit.paintBordersFor(combo);

    // Register decorators for each control.
    // CB Decoration is done automatically by the Message Manager.
    // validationService.registerAllDecorators(txtLogin, lblLogin);
    // validationService.registerAllDecorators(txtFirstName, lblFirstName);
    // validationService.registerAllDecorators(txtLastName, lblLastName);
    // validationService.registerAllDecorators(txtEmail, lblEmail);
    // validationService.registerAllDecorators(btnCheck, btnCheck);
    // validationService.registerAllDecorators(txtPass, lblPassword);
    // validationService.registerAllDecorators(txtConfirm, lblConfirm);
    // validationService.registerAllDecorators(combo, lblRole);
}

From source file:com.nokia.carbide.cpp.internal.project.ui.mmpEditor.dialogs.ChooseDirectoryComposite.java

License:Open Source License

/**
 * Create contents of the dialog// ww  w. ja v a2s .  com
 * @param parent
 */
private void createContents() {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 3;
    setLayout(gridLayout);

    Label chooseAProjectLabel;
    chooseAProjectLabel = new Label(this, SWT.WRAP);
    chooseAProjectLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    chooseAProjectLabel.setText(Messages.getString("IncludeDirectoryDialog.promptLabel")); //$NON-NLS-1$

    Label fillerLable1;
    fillerLable1 = new Label(this, SWT.WRAP);
    fillerLable1.setLayoutData(new GridData(SWT.DEFAULT));

    Label includeDirectoryLabel = new Label(this, SWT.NONE);
    includeDirectoryLabel.setText(Messages.getString("IncludeDirectoryDialog.includeDirectoryLabel")); //$NON-NLS-1$

    pathViewer = new ComboViewer(this, SWT.NONE);
    pathViewer.setContentProvider(new ArrayContentProvider());
    pathViewer.setLabelProvider(new LabelProvider());
    pathViewer.setSorter(new ViewerSorter());
    Combo combo;
    combo = pathViewer.getCombo();
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    browseButton = new Button(this, SWT.NONE);
    browseButton.setText(Messages.getString("IncludeDirectoryDialog.browseButton")); //$NON-NLS-1$
    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            doBrowse();
        }
    });

    populate();
}

From source file:com.nokia.carbide.cpp.internal.project.ui.mmpEditor.dialogs.ChooseFileComposite.java

License:Open Source License

private void createContents() {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.verticalSpacing = 10;// w  ww.j a  v a  2s . c  om
    gridLayout.numColumns = 3;
    setLayout(gridLayout);

    Label projectFilesLabel;

    final Label chooseAProjectLabel = new Label(this, SWT.WRAP);
    final GridData gridData_3 = new GridData(SWT.LEFT, SWT.CENTER, true, false, 3, 1);
    gridData_3.widthHint = 471;
    chooseAProjectLabel.setLayoutData(gridData_3);
    chooseAProjectLabel.setText(Messages.getString("ChooseFileComposite.prompt")); //$NON-NLS-1$
    projectFilesLabel = new Label(this, SWT.NONE);
    projectFilesLabel.setLayoutData(new GridData(102, SWT.DEFAULT));
    projectFilesLabel.setText(fileViewerLabel);

    filePathViewer = new ComboViewer(this, SWT.NONE);
    filePathViewer.setContentProvider(new ArrayContentProvider());
    filePathViewer.setLabelProvider(new LabelProvider());
    filePathViewer.setSorter(new ViewerSorter());
    Combo fileCombo = filePathViewer.getCombo();
    fileCombo.setLayoutData(new GridData(180, SWT.DEFAULT));
    filePathViewer.setInput(new Object());

    browseButton = new Button(this, SWT.NONE);
    final GridData gridData_5 = new GridData();
    gridData_5.horizontalIndent = 10;
    browseButton.setLayoutData(gridData_5);
    browseButton.setText(Messages.getString("ResourceBlockDialog.browseButton")); //$NON-NLS-1$
    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            doBrowse();
        }
    });
}

From source file:com.nokia.carbide.cpp.internal.project.ui.mmpEditor.dialogs.ResourceBlockDialog.java

License:Open Source License

/**
 * Create contents of the dialog/*from  www.  j  av  a2s  .c om*/
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.verticalSpacing = 10;
    gridLayout.numColumns = 2;
    container.setLayout(gridLayout);

    Label uid2Label;

    Label uid3Label;

    final Group sourcePathGroup = new Group(container, SWT.NONE);
    sourcePathGroup.setLayout(new FillLayout());
    sourcePathGroup.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
    sourcePathGroup.setText(Messages.getString("ResourceBlockDialog.rssGroupLabel")); //$NON-NLS-1$

    chooseFileComposite = new ChooseFileComposite(sourcePathGroup, SWT.NONE, resourceBlock.getSource(),
            EMMPPathContext.START_RESOURCE, pathHelper, buildConfiguration, getRSSFiles(),
            new String[] { "*.rss" }, //$NON-NLS-1$
            Messages.getString("ResourceBlockDialog.rssFilePathLabel")); //$NON-NLS-1$

    final Label targetFileNameLabel = new Label(container, SWT.NONE);
    targetFileNameLabel.setLayoutData(new GridData(110, SWT.DEFAULT));
    targetFileNameLabel.setText(Messages.getString("ResourceBlockDialog.targetNameLabel")); //$NON-NLS-1$

    targetFileText = new Text(container, SWT.BORDER);
    final GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false);
    gridData.widthHint = 180;
    targetFileText.setLayoutData(gridData);

    final Label targetFilePathLabel = new Label(container, SWT.NONE);
    targetFilePathLabel.setText(Messages.getString("ResourceBlockDialog.targetPathLabel")); //$NON-NLS-1$

    targetPathViewer = new ComboViewer(container, SWT.BORDER);
    targetPathViewer.setContentProvider(new ArrayContentProvider());
    targetPathViewer.setLabelProvider(new TargetPathLabelProvider());
    Combo targetPathCombo = targetPathViewer.getCombo();
    final GridData gridData_1 = new GridData(SWT.LEFT, SWT.CENTER, true, false);
    gridData_1.widthHint = 180;
    targetPathCombo.setLayoutData(gridData_1);
    targetPathViewer.setInput(new Object());

    uid2Label = new Label(container, SWT.NONE);
    uid2Label.setText(Messages.getString("ResourceBlockDialog.uid2Label")); //$NON-NLS-1$

    uid2Text = new Text(container, SWT.BORDER);
    final GridData gridData_2 = new GridData(SWT.LEFT, SWT.CENTER, true, false);
    gridData_2.widthHint = 180;
    uid2Text.setLayoutData(gridData_2);
    uid3Label = new Label(container, SWT.NONE);
    uid3Label.setText(Messages.getString("ResourceBlockDialog.uid3Label")); //$NON-NLS-1$

    uid3Text = new Text(container, SWT.BORDER);
    uid3Text.setLayoutData(new GridData(180, SWT.DEFAULT));

    if (supportHeaderOnly) {
        headerRadiosComposite = new Composite(container, SWT.NONE);
        headerRadiosComposite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
        final RowLayout headerRadiosComposite = new RowLayout();
        this.headerRadiosComposite.setLayout(headerRadiosComposite);

        dontGenerateHeaderButton = new Button(this.headerRadiosComposite, SWT.RADIO);
        dontGenerateHeaderButton.setText(Messages.getString("ResourceBlockDialog.noHeaderButton")); //$NON-NLS-1$

        generateHeaderButton = new Button(this.headerRadiosComposite, SWT.RADIO);
        generateHeaderButton.setText(Messages.getString("ResourceBlockDialog.generateHeaderButton")); //$NON-NLS-1$

        onlyGenerateHeaderButton = new Button(this.headerRadiosComposite, SWT.RADIO);
        onlyGenerateHeaderButton.setText(Messages.getString("ResourceBlockDialog.headerOnlyButton")); //$NON-NLS-1$
    } else {
        generateHeaderCheckbox = new Button(container, SWT.CHECK);
        generateHeaderCheckbox.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
        generateHeaderCheckbox.setText(Messages.getString("ResourceBlockDialog.generateHeaderCheckbox")); //$NON-NLS-1$
    }

    populate();
    //
    return container;
}

From source file:com.nokia.carbide.cpp.internal.project.ui.mmpEditor.dialogs.ToolOptionsDialog.java

License:Open Source License

/**
 * Create contents of the dialog/*from   www  .  j  av a2 s .c  om*/
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    container.setLayout(new FormLayout());

    final Label selectTheToolLabel = new Label(container, SWT.NONE);
    final FormData formData_1 = new FormData();
    formData_1.right = new FormAttachment(100, -5);
    formData_1.top = new FormAttachment(0, 10);
    formData_1.left = new FormAttachment(0, 5);
    selectTheToolLabel.setLayoutData(formData_1);
    if (isAdding) {
        selectTheToolLabel.setText(Messages.getString("ToolOptionsDialog.addPromptLabel")); //$NON-NLS-1$
    } else {
        selectTheToolLabel.setText(Messages.getString("ToolOptionsDialog.editPromptLabel")); //$NON-NLS-1$
    }

    final Label toolChainLabel = new Label(container, SWT.NONE);
    final FormData formData = new FormData();
    formData.bottom = new FormAttachment(0, 63);
    formData.top = new FormAttachment(0, 50);
    formData.right = new FormAttachment(selectTheToolLabel, 60, SWT.LEFT);
    formData.left = new FormAttachment(selectTheToolLabel, 0, SWT.LEFT);
    toolChainLabel.setLayoutData(formData);
    toolChainLabel.setText(Messages.getString("ToolOptionsDialog.toolChainLabel")); //$NON-NLS-1$

    toolChainViewer = new ComboViewer(container, SWT.READ_ONLY);
    Combo combo = toolChainViewer.getCombo();
    final FormData formData_2 = new FormData();
    formData_2.bottom = new FormAttachment(0, 66);
    formData_2.top = new FormAttachment(0, 45);
    formData_2.right = new FormAttachment(0, 195);
    formData_2.left = new FormAttachment(0, 65);
    combo.setLayoutData(formData_2);
    toolChainViewer.setLabelProvider(new ToolChainLabelProvider());
    toolChainViewer.setContentProvider(new ArrayContentProvider());
    toolChainViewer.setSorter(new ViewerSorter());
    toolChainViewer.setInput(toolChains.keySet().toArray());
    if (theToolChain != null) {
        toolChainViewer.setSelection(new StructuredSelection(theToolChain));
    }
    if (isAdding) {
        selectFirstAvailableToolChain();
        toolChainViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                toolChainSelectionChanged();
            }
        });
    } else {
        // if we're editing an existing value don't allow changing the tool chain
        // this avoids asking the user how to handle the case when the options field
        // has text and the user switches to another tool chain that already has text.
        toolChainViewer.getControl().setEnabled(false);
    }

    final Label optionsLabel = new Label(container, SWT.NONE);
    final FormData formData_3 = new FormData();
    formData_3.left = new FormAttachment(0, 5);
    formData_3.top = new FormAttachment(toolChainLabel, 24, SWT.DEFAULT);
    formData_3.bottom = new FormAttachment(0, 100);
    optionsLabel.setLayoutData(formData_3);
    optionsLabel.setText(Messages.getString("ToolOptionsDialog.optionsTextLabel")); //$NON-NLS-1$

    optionsText = new Text(container, SWT.BORDER);
    final FormData formData_4 = new FormData();
    formData_4.right = new FormAttachment(selectTheToolLabel, 0, SWT.RIGHT);
    formData_4.top = new FormAttachment(optionsLabel, 0, SWT.TOP);
    formData_4.left = new FormAttachment(combo, 0, SWT.LEFT);
    optionsText.setLayoutData(formData_4);
    if (theOptions != null) {
        optionsText.setText(theOptions);
    }
    return container;
}