List of usage examples for org.eclipse.jface.viewers ComboViewer ComboViewer
public ComboViewer(Composite parent, int style)
From source file:gov.redhawk.ide.codegen.ui.BooleanGeneratorPropertiesWizardPage.java
License:Open Source License
/** * {@inheritDoc}//from w w w . j ava 2s.co m */ @Override public void createControl(final Composite parent) { final Composite client = new Composite(parent, SWT.NULL); client.setLayout(new GridLayout(2, false)); Label label; final GridDataFactory labelFactory = GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.FILL); label = new Label(client, SWT.NULL); label.setText("Generator:"); label.setLayoutData(labelFactory.create()); this.generatorLabel = new Text(client, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER); this.generatorLabel.setEnabled(false); this.generatorLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); label = new Label(client, SWT.NULL); label.setText("Template:"); this.templateViewer = new ComboViewer(client, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY | SWT.DROP_DOWN); this.templateViewer.getControl() .setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); this.templateViewer.setContentProvider(new ArrayContentProvider()); this.templateViewer.setLabelProvider(new LabelProvider() { /** * {@inheritDoc} */ @Override public String getText(final Object element) { if (element instanceof ITemplateDesc) { return ((ITemplateDesc) element).getName(); } return super.getText(element); } }); this.templateViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { final ITemplateDesc desc = (ITemplateDesc) ((IStructuredSelection) event.getSelection()) .getFirstElement(); if (desc != null) { if (desc != BooleanGeneratorPropertiesWizardPage.this.selectedTemplate) { BooleanGeneratorPropertiesWizardPage.this.selectedTemplate = desc; // Remove the old templates properties final EList<Property> properties = BooleanGeneratorPropertiesWizardPage.this.implSettings .getProperties(); if (properties.size() != 0) { properties.clear(); } // Add the new templates properties for (final IPropertyDescriptor value : desc.getPropertyDescriptors()) { if (!value.isDeprecated()) { final Property p = CodegenFactory.eINSTANCE.createProperty(); p.setId(value.getKey()); p.setValue(value.getDefaultValue()); properties.add(p); } } // Update the properties displayed BooleanGeneratorPropertiesWizardPage.this.propertiesViewer .setInput(desc.getPropertyDescriptors()); // Unbind the old properties and bind the new ones if (BooleanGeneratorPropertiesWizardPage.this.propBinding != null) { BooleanGeneratorPropertiesWizardPage.this.bindings .remove(BooleanGeneratorPropertiesWizardPage.this.propBinding); } BooleanGeneratorPropertiesWizardPage.this.propBinding = createPropertyBinding(); BooleanGeneratorPropertiesWizardPage.this.bindings .add(BooleanGeneratorPropertiesWizardPage.this.propBinding); } // Save the new template and update the tooltip BooleanGeneratorPropertiesWizardPage.this.implSettings.setTemplate(desc.getId()); BooleanGeneratorPropertiesWizardPage.this.templateViewer.getCombo() .setToolTipText(desc.getDescription()); } else { BooleanGeneratorPropertiesWizardPage.this.implSettings.setTemplate(null); } } }); label = new Label(client, SWT.NULL); label.setText("Output Directory:"); this.outputDirText = new Text(client, SWT.BORDER); this.outputDirText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); createExtraArea(client, labelFactory, ((GridLayout) client.getLayout()).numColumns); label = new Label(client, SWT.NULL); label.setText("Properties:"); label.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.TOP).create()); this.propertiesViewer = new CheckboxTableViewer(new Table(client, SWT.CHECK | SWT.READ_ONLY | SWT.BORDER)); ColumnViewerToolTipSupport.enableFor(this.propertiesViewer); this.propertiesViewer.setContentProvider(new ArrayContentProvider()); final ViewerFilter[] filters = new ViewerFilter[1]; filters[0] = new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IPropertyDescriptor) { return !((IPropertyDescriptor) element).isDeprecated(); } return true; } }; this.propertiesViewer.setFilters(filters); final CellLabelProvider labelProvider = new CellLabelProvider() { public String getText(final Object element) { String text = ""; if (element instanceof IPropertyDescriptor) { if (((IPropertyDescriptor) element).getName().length() != 0) { text = ((IPropertyDescriptor) element).getName(); } else { text = ((IPropertyDescriptor) element).getKey(); } } return text; } @Override public String getToolTipText(final Object element) { String text = "No description available for this property"; if (element instanceof IPropertyDescriptor) { if (((IPropertyDescriptor) element).getDescription().length() != 0) { text = ((IPropertyDescriptor) element).getDescription(); } } return text; } @Override public Point getToolTipShift(final Object object) { return new Point(5, 5); // SUPPRESS CHECKSTYLE MagicNumber } @Override public int getToolTipDisplayDelayTime(final Object object) { return BooleanGeneratorPropertiesWizardPage.TOOLTIP_DELAY_MILLIS; } @Override public int getToolTipTimeDisplayed(final Object object) { return BooleanGeneratorPropertiesWizardPage.TOOLTIP_DISPLAY_TIME_MILLIS; } @Override public void update(final ViewerCell cell) { cell.setText(getText(cell.getElement())); } }; this.propertiesViewer.setLabelProvider(labelProvider); this.propertiesViewer.getControl() .setLayoutData(GridDataFactory.fillDefaults().span(1, 2).grab(false, true).create()); if (this.configured) { bind(); } this.created = true; setControl(client); }
From source file:gov.redhawk.ide.codegen.ui.DefaultGeneratorPropertiesWizardPage.java
License:Open Source License
/** * {@inheritDoc}// ww w. java 2 s. c o m */ @Override public void createControl(final Composite parent) { // SUPPRESS CHECKSTYLE MethodLength final Composite client = new Composite(parent, SWT.NULL); client.setLayout(new GridLayout(2, false)); Label label; final GridDataFactory labelFactory = GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.FILL); label = new Label(client, SWT.NULL); label.setText("Generator:"); label.setLayoutData(labelFactory.create()); this.generatorLabel = new Text(client, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER); this.generatorLabel.setEnabled(false); this.generatorLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); label = new Label(client, SWT.NULL); label.setText("Template:"); this.templateViewer = new ComboViewer(client, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY | SWT.DROP_DOWN); this.templateViewer.getControl() .setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); this.templateViewer.setContentProvider(new ArrayContentProvider()); this.templateViewer.setLabelProvider(new LabelProvider() { /** * {@inheritDoc} */ @Override public String getText(final Object element) { if (element instanceof ITemplateDesc) { return ((ITemplateDesc) element).getName(); } return super.getText(element); } }); this.templateViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { final ITemplateDesc desc = (ITemplateDesc) ((IStructuredSelection) event.getSelection()) .getFirstElement(); if (desc != null) { if (desc != DefaultGeneratorPropertiesWizardPage.this.selectedTemplate) { DefaultGeneratorPropertiesWizardPage.this.selectedTemplate = desc; // Remove the old templates properties final EList<Property> properties = DefaultGeneratorPropertiesWizardPage.this.implSettings .getProperties(); if (properties.size() != 0) { properties.clear(); } // Add the new templates properties for (final IPropertyDescriptor value : desc.getPropertyDescriptors()) { if (!value.isDeprecated()) { final Property p = CodegenFactory.eINSTANCE.createProperty(); p.setId(value.getKey()); p.setValue(value.getDefaultValue()); properties.add(p); } } // Update the properties displayed DefaultGeneratorPropertiesWizardPage.this.propertiesViewer .setInput(desc.getPropertyDescriptors()); } // Save the new template and update the tooltip DefaultGeneratorPropertiesWizardPage.this.implSettings.setTemplate(desc.getId()); DefaultGeneratorPropertiesWizardPage.this.templateViewer.getCombo() .setToolTipText(desc.getDescription()); } else { DefaultGeneratorPropertiesWizardPage.this.implSettings.setTemplate(null); } } }); label = new Label(client, SWT.NULL); label.setText("Output Directory:"); this.outputDirText = new Text(client, SWT.BORDER); this.outputDirText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); createExtraArea(client, labelFactory, ((GridLayout) client.getLayout()).numColumns); label = new Label(client, SWT.NULL); label.setText("Properties:"); label.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.TOP).create()); final Composite tableComp = new Composite(client, SWT.NULL); final GridLayout layout = SWTUtil.TABLE_ENTRY_LAYOUT_FACTORY.create(); tableComp.setLayout(layout); tableComp.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).create()); final Table table = new Table(tableComp, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); table.setLayoutData(GridDataFactory.fillDefaults().span(1, 3).grab(true, true).create()); // SUPPRESS CHECKSTYLE // MagicNumber table.setLinesVisible(true); table.setHeaderVisible(true); final TableLayout tableLayout = new TableLayout(); tableLayout.addColumnData(new ColumnWeightData(40, 100, true)); // SUPPRESS CHECKSTYLE MagicNumber tableLayout.addColumnData(new ColumnWeightData(60, 70, true)); // SUPPRESS CHECKSTYLE MagicNumber table.setLayout(tableLayout); final TableColumn idColumn = new TableColumn(table, SWT.NULL); idColumn.setText("Name"); final TableColumn valueColumn = new TableColumn(table, SWT.NULL); valueColumn.setText("Value"); this.propertiesViewer = new TableViewer(table); ColumnViewerToolTipSupport.enableFor(this.propertiesViewer); final TableViewerColumn idViewer = new TableViewerColumn(this.propertiesViewer, idColumn); idViewer.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { String text = ""; if (element instanceof Property) { if (((Property) element).getId().length() != 0) { final ICodeGeneratorDescriptor generator = RedhawkCodegenActivator .getCodeGeneratorsRegistry().findCodegen( DefaultGeneratorPropertiesWizardPage.this.implSettings.getGeneratorId()); final ITemplateDesc template = getTemplateDesc(generator); for (final IPropertyDescriptor propDesc : template.getPropertyDescriptors()) { if (propDesc.getKey().equals(((Property) element).getId())) { text = propDesc.getName(); break; } } } } return text; }; @Override public String getToolTipText(final Object element) { String text = "No description available for this property"; if (element instanceof Property) { if (((Property) element).getId().length() != 0) { final ICodeGeneratorDescriptor generator = RedhawkCodegenActivator .getCodeGeneratorsRegistry().findCodegen( DefaultGeneratorPropertiesWizardPage.this.implSettings.getGeneratorId()); final ITemplateDesc template = getTemplateDesc(generator); for (final IPropertyDescriptor propDesc : template.getPropertyDescriptors()) { if (propDesc.getKey().equals(((Property) element).getId())) { text = propDesc.getDescription(); break; } } } } return text; }; @Override public Point getToolTipShift(final Object object) { return new Point(5, 5); // SUPPRESS CHECKSTYLE MagicNumber } @Override public int getToolTipDisplayDelayTime(final Object object) { return DefaultGeneratorPropertiesWizardPage.TOOLTIP_DELAY_MILLIS; } @Override public int getToolTipTimeDisplayed(final Object object) { return DefaultGeneratorPropertiesWizardPage.TOOLTIP_DISPLAY_TIME_MILLIS; } }); final TableViewerColumn valueViewer = new TableViewerColumn(this.propertiesViewer, valueColumn); valueViewer.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { String text = ""; if (element instanceof Property) { final Property prop = (Property) element; if (prop.getId().length() != 0) { final ICodeGeneratorDescriptor generator = RedhawkCodegenActivator .getCodeGeneratorsRegistry().findCodegen( DefaultGeneratorPropertiesWizardPage.this.implSettings.getGeneratorId()); final ITemplateDesc template = getTemplateDesc(generator); for (final IPropertyDescriptor propDesc : template.getPropertyDescriptors()) { if (propDesc.getKey().equals(prop.getId())) { text = propDesc.getDefaultValue(); for (final Property tempProp : DefaultGeneratorPropertiesWizardPage.this.implSettings .getProperties()) { if (tempProp.getId().equals(prop.getId())) { text = tempProp.getValue(); break; } } break; } } } } return text; }; }); this.propertiesViewer.setContentProvider(new AdapterFactoryContentProvider(getAdapterFactory())); this.propertiesViewer.setComparator(createPropertiesViewerComparator()); this.propertiesViewer.setFilters(createPropertiesViewerFilter()); this.propertiesViewer.setColumnProperties(new String[] { CodegenPackage.Literals.PROPERTY__ID.getName(), CodegenPackage.Literals.PROPERTY__VALUE.getName() }); final Button addButton = new Button(tableComp, SWT.PUSH); addButton.setText("Add..."); addButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).create()); addButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { handleAddProperty(); } }); final Button editButton = new Button(tableComp, SWT.PUSH); editButton.setText("Edit"); editButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).create()); editButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { handleEditProperty(); } }); editButton.setEnabled(false); final Button removeButton = new Button(tableComp, SWT.PUSH); removeButton.setText("Remove"); removeButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).create()); removeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { handleRemoveProperty(); } }); removeButton.setEnabled(!this.propertiesViewer.getSelection().isEmpty()); this.propertiesViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { removeButton.setEnabled(!event.getSelection().isEmpty()); editButton.setEnabled(!event.getSelection().isEmpty()); } }); if (this.configured) { bind(); } this.created = true; setControl(client); setPageComplete(false); }
From source file:gov.redhawk.ide.codegen.ui.internal.GeneratorDialog.java
License:Open Source License
/** * {@inheritDoc}// w w w .j av a2s . c o m */ @Override protected Control createDialogArea(final Composite parent) { // create composite final Composite composite = (Composite) super.createDialogArea(parent); final GridLayout layout = (GridLayout) composite.getLayout(); layout.numColumns = GeneratorDialog.NUM_COLUMNS; Label label = new Label(composite, SWT.WRAP); label.setText("Port RepID:"); label.setFont(parent.getFont()); this.repIdViewer = new ComboViewer(composite, getInputTextStyle() | SWT.READ_ONLY); this.repIdViewer.getCombo().setEnabled(this.value == null); this.repIdViewer.getCombo().addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { final String key = GeneratorDialog.this.repIdViewer.getCombo().getText(); IPortTemplateDesc gen = null; // Get all the generators for this rep final IPortTemplateDesc[] gens = RedhawkCodegenActivator.getCodeGeneratorPortTemplatesRegistry() .findTemplatesByRepId(key, GeneratorDialog.this.language); GeneratorDialog.this.generatorViewer.setInput(gens); // If we have a saved value, try to reselect it if (GeneratorDialog.this.value != null) { gen = CodegenUtil.getPortTemplate(GeneratorDialog.this.value.getGenerator(), null); } // If we couldn't find the value, or none is selected, choose the first if ((gen == null) && (gens.length > 0)) { gen = gens[0]; } // If we have something to select, select it if (gen != null) { GeneratorDialog.this.generatorViewer .setSelection(new StructuredSelection(Collections.singletonList(gen))); GeneratorDialog.this.descriptionText .setText((gen.getDescription() == null) ? "" : gen.getDescription().trim()); // SUPPRESS CHECKSTYLE AvoidInline } // Validate the dialog validate(); } }); this.repIdViewer.setContentProvider(new ArrayContentProvider()); this.repIdViewer.getControl() .setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); this.descriptionText = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.BORDER); this.descriptionText.setEditable(false); this.descriptionText.setEnabled(false); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, GeneratorDialog.NUM_COLUMNS); data.widthHint = 200; // SUPPRESS CHECKSTYLE MagicNumber data.heightHint = (int) (data.widthHint * 0.75); // SUPPRESS CHECKSTYLE MagicNumber this.descriptionText.setLayoutData(data); label = new Label(composite, SWT.WRAP); label.setText("Generator:"); label.setFont(parent.getFont()); this.generatorViewer = new ComboViewer(composite, getInputTextStyle() | SWT.READ_ONLY); this.generatorViewer.getCombo().addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(final SelectionEvent e) { widgetSelected(e); } @Override public void widgetSelected(final SelectionEvent e) { final IPortTemplateDesc gen = (IPortTemplateDesc) ((IStructuredSelection) GeneratorDialog.this.generatorViewer .getSelection()).getFirstElement(); GeneratorDialog.this.descriptionText .setText((gen.getDescription() == null) ? "" : gen.getDescription().trim()); // SUPPRESS CHECKSTYLE AvoidInline validate(); } }); this.generatorViewer.setLabelProvider(new LabelProvider() { @Override public String getText(final Object element) { return ((IPortTemplateDesc) element).getName(); } }); this.generatorViewer.setContentProvider(new ArrayContentProvider()); this.generatorViewer.getControl() .setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); this.errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); data.horizontalSpan = GeneratorDialog.NUM_COLUMNS; this.errorMessageText.setLayoutData(data); this.errorMessageText .setBackground(this.errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); // Set the error message text // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292 setErrorMessage(this.errorMessage); Dialog.applyDialogFont(composite); return composite; }
From source file:gov.redhawk.ide.codegen.ui.internal.PropertyDialog.java
License:Open Source License
/** * {@inheritDoc}//www . j ava 2s .co m */ @Override protected Control createDialogArea(final Composite parent) { // create composite final Composite composite = (Composite) super.createDialogArea(parent); final GridLayout layout = (GridLayout) composite.getLayout(); layout.numColumns = 3; // SUPPRESS CHECKSTYLE MagicNumber Label label = new Label(composite, SWT.WRAP); label.setText("ID:"); label.setFont(parent.getFont()); this.idText = new ComboViewer(composite, getInputTextStyle() | SWT.READ_ONLY); this.idText.getCombo().addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { final String key = PropertyDialog.this.idText.getCombo().getText(); String v = null; for (final IPropertyDescriptor pDesc : PropertyDialog.this.desc.getPropertyDescriptors()) { if (pDesc.getKey().equals(key)) { v = pDesc.getDescription(); if (PropertyDialog.this.valueText.getText().length() == 0) { PropertyDialog.this.valueText.setText(pDesc.getDefaultValue()); } break; } } if (v == null) { v = ""; } PropertyDialog.this.descriptionText.setText(v.trim()); validate(); } }); this.idText.setLabelProvider(new LabelProvider() { @Override public String getText(final Object element) { final IPropertyDescriptor prop = (IPropertyDescriptor) element; return prop.getKey(); } }); this.idText.setContentProvider(new ArrayContentProvider()); this.idText.getControl() .setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); this.descriptionText = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.BORDER); this.descriptionText.setEditable(false); this.descriptionText.setEnabled(false); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2); data.widthHint = 200; // SUPPRESS CHECKSTYLE MagicNumber data.heightHint = (int) (data.widthHint * 0.75); // SUPPRESS CHECKSTYLE MagicNumber this.descriptionText.setLayoutData(data); label = new Label(composite, SWT.WRAP); label.setText("Value:"); label.setFont(parent.getFont()); label.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.TOP).grab(false, true).create()); this.valueText = new Text(composite, getInputTextStyle()); this.valueText .setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).create()); this.valueText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { validate(); } }); this.errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); data.horizontalSpan = layout.numColumns; this.errorMessageText.setLayoutData(data); this.errorMessageText .setBackground(this.errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); // Set the error message text // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292 setErrorMessage(this.errorMessage); Dialog.applyDialogFont(composite); return composite; }
From source file:gov.redhawk.ide.dcd.internal.ui.editor.composite.ComponentPlacementComposite.java
License:Open Source License
/** * Creates the generator entry.//from www . j a v a2s .c o m * * @param client the client * @param toolkit the toolkit * @param actionBars the action bars */ private void createParentEntry() { final Label label = this.toolkit.createLabel(this, "Parent:"); label.setForeground(this.toolkit.getColors().getColor(IFormColors.TITLE)); this.parentViewer = new ComboViewer(this, SWT.SINGLE | SWT.READ_ONLY | SWT.DROP_DOWN); this.parentViewer.getCombo().addListener(SWT.MouseVerticalWheel, new Listener() { @Override public void handleEvent(Event event) { // Disable Mouse Wheel Combo Box Control event.doit = false; } }); this.parentViewer.setContentProvider(new ArrayContentProvider()); this.parentViewer.setLabelProvider(new LabelProvider() { @Override public String getText(final Object element) { final DcdComponentPlacement desc = (DcdComponentPlacement) element; return (desc != null) ? desc.getComponentInstantiation().get(0).getUsageName() : ""; // SUPPRESS CHECKSTYLE AvoidInline } }); this.parentViewer.getControl() .setLayoutData(GridDataFactory.fillDefaults().span(1, 1).grab(true, false).create()); this.unsetParentButton = this.toolkit.createButton(this, "Unset", SWT.PUSH); this.unsetParentButton.setLayoutData(GridDataFactory.fillDefaults().span(1, 1).grab(false, false).create()); this.unsetParentButton.setEnabled(false); }
From source file:gov.redhawk.ide.dcd.internal.ui.handlers.LaunchDeviceManagerDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { Label label = new Label(parent, SWT.NULL); label.setText("Debug Level: "); ComboViewer debugViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER); debugViewer.setContentProvider(new ArrayContentProvider()); debugViewer.setInput(DebugLevel.values()); debugViewer.setSelection(new StructuredSelection(DebugLevel.Info)); context.bindValue(ViewersObservables.observeSingleSelection(debugViewer), PojoObservables.observeValue(configuration, DeviceManagerLaunchConfiguration.PROP_DEBUG_LEVEL)); label = new Label(parent, SWT.NULL); label.setText("Arguments: "); Text text = new Text(parent, SWT.BORDER); context.bindValue(SWTObservables.observeText(text, SWT.Modify), PojoObservables.observeValue(configuration, DeviceManagerLaunchConfiguration.PROP_ARGUMENTS)); super.createButtonsForButtonBar(parent); }
From source file:gov.redhawk.ide.prf.ui.wizard.SimpleFormPage.java
License:Open Source License
/** * Creates the simple property config page. * // w w w.j a v a 2 s . c o m * @return the composite */ private Composite createControls() { final Composite client = this; client.setLayout(new GridLayout(SimpleFormPage.NUM_COLUMNS, false)); Label label; Button button; GridData data; label = new Label(client, SWT.None); label.setText("ID:"); this.idText = new Text(client, SWT.BORDER); this.idText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); this.context.bindValue( WidgetProperties.text(SWT.Modify).observeDelayed(SCAFormEditor.getFieldBindingDelay(), this.idText), EMFObservables.observeValue(this.simple, PrfPackage.Literals.ABSTRACT_PROPERTY__ID), null, null); button = new Button(client, SWT.PUSH); button.setText("Generate"); button.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(final SelectionEvent e) { SimpleFormPage.this.simple.setId(DceUuidUtil.createDceUUID()); } }); label = new Label(client, SWT.None); label.setText("Type:"); this.typeViewer = new ComboViewer(client, SWT.None); this.typeViewer.setContentProvider(new ArrayContentProvider()); this.typeViewer.setLabelProvider(new LabelProvider()); this.typeViewer.setInput(PropertyValueType.values()); data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; this.typeViewer.getControl().setLayoutData(data); this.context.bindValue(ViewersObservables.observeSingleSelection(this.typeViewer), EMFObservables.observeValue(this.simple, PrfPackage.Literals.SIMPLE__TYPE), null, null); label = new Label(client, SWT.None); label.setText("Name:"); this.nameText = new Text(client, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; this.nameText.setLayoutData(data); this.context.bindValue( WidgetProperties.text(SWT.Modify).observeDelayed(SCAFormEditor.getFieldBindingDelay(), this.nameText), EMFObservables.observeValue(this.simple, PrfPackage.Literals.ABSTRACT_PROPERTY__NAME), null, null); label = new Label(client, SWT.None); label.setText("Mode:"); this.modeViewer = new ComboViewer(client, SWT.None); this.modeViewer.setContentProvider(new ArrayContentProvider()); this.modeViewer.setLabelProvider(new LabelProvider()); this.modeViewer.setInput(AccessType.values()); this.modeViewer.setSelection(new StructuredSelection(AccessType.READWRITE)); data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; this.modeViewer.getControl().setLayoutData(data); this.context.bindValue(ViewersObservables.observeSingleSelection(this.modeViewer), EMFObservables.observeValue(this.simple, PrfPackage.Literals.ABSTRACT_PROPERTY__MODE), null, null); return client; }
From source file:gov.redhawk.ide.prf.ui.wizard.SimpleSequenceFormPage.java
License:Open Source License
/** * Creates the simple property config page. * /*from w ww .ja va2s . c o m*/ * @return the composite */ private Composite createControls() { final Composite client = this; client.setLayout(new GridLayout(SimpleSequenceFormPage.NUM_COLUMNS, false)); Label label; Button button; GridData data; label = new Label(client, SWT.None); label.setText("ID:"); this.idText = new Text(client, SWT.BORDER); this.idText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); this.context.bindValue( WidgetProperties.text(SWT.Modify).observeDelayed(SCAFormEditor.getFieldBindingDelay(), this.idText), EMFObservables.observeValue(this.simpleSequence, PrfPackage.Literals.ABSTRACT_PROPERTY__ID), null, null); button = new Button(client, SWT.PUSH); button.setText("Generate"); button.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(final SelectionEvent e) { SimpleSequenceFormPage.this.simpleSequence.setId(DceUuidUtil.createDceUUID()); } }); label = new Label(client, SWT.None); label.setText("Type:"); this.typeViewer = new ComboViewer(client, SWT.None); this.typeViewer.setContentProvider(new ArrayContentProvider()); this.typeViewer.setLabelProvider(new LabelProvider()); this.typeViewer.setInput(PropertyValueType.values()); data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; this.typeViewer.getControl().setLayoutData(data); this.context.bindValue(ViewersObservables.observeSingleSelection(this.typeViewer), EMFObservables.observeValue(this.simpleSequence, PrfPackage.Literals.SIMPLE_SEQUENCE__TYPE), null, null); label = new Label(client, SWT.None); label.setText("Name:"); this.nameText = new Text(client, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; this.nameText.setLayoutData(data); this.context.bindValue( WidgetProperties.text(SWT.Modify).observeDelayed(SCAFormEditor.getFieldBindingDelay(), this.nameText), EMFObservables.observeValue(this.simpleSequence, PrfPackage.Literals.ABSTRACT_PROPERTY__NAME), null, null); label = new Label(client, SWT.None); label.setText("Mode:"); this.modeViewer = new ComboViewer(client, SWT.None); this.modeViewer.setContentProvider(new ArrayContentProvider()); this.modeViewer.setLabelProvider(new LabelProvider()); this.modeViewer.setInput(AccessType.values()); this.modeViewer.setSelection(new StructuredSelection(AccessType.READWRITE)); data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 2; this.modeViewer.getControl().setLayoutData(data); this.context.bindValue(ViewersObservables.observeSingleSelection(this.modeViewer), EMFObservables.observeValue(this.simpleSequence, PrfPackage.Literals.ABSTRACT_PROPERTY__MODE), null, null); return client; }
From source file:gov.redhawk.ide.sdr.ui.internal.handlers.LaunchDomainManagerWithOptionsDialog.java
License:Open Source License
@Override protected Control createDialogArea(final Composite root) { final Composite composite = new Composite(root, SWT.NONE); final GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);//from www . j a v a2s . co m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); final GridLayout gridLayout = new GridLayout(3, false); final GridDataFactory textFactory = GridDataFactory.fillDefaults().grab(true, false).span(2, 1); final GridData data; final Group domainManagerGroup = new Group(composite, SWT.NULL); domainManagerGroup.setText("Domain Manager"); domainManagerGroup.setLayout(gridLayout); domainManagerGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Label label = new Label(domainManagerGroup, SWT.NULL); label.setText("Domain Name: "); Text text = new Text(domainManagerGroup, SWT.BORDER); data = textFactory.create(); data.horizontalSpan = 2; text.setLayoutData(data); this.nameBinding = this.context.bindValue(SWTObservables.observeText(text, SWT.Modify), PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_DOMAIN_NAME), new UpdateValueStrategy().setAfterConvertValidator(this.nameValidator), null); text.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { updateButtonsEnableState((IStatus) LaunchDomainManagerWithOptionsDialog.this.nameBinding .getValidationStatus().getValue()); } }); ControlDecorationSupport.create(this.nameBinding, SWT.TOP | SWT.LEFT); label = new Label(domainManagerGroup, SWT.NULL); label.setText("Debug Level: "); ComboViewer debugViewer = new ComboViewer(domainManagerGroup, SWT.READ_ONLY | SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER); debugViewer.setLabelProvider(new LabelProvider()); debugViewer.setContentProvider(new ArrayContentProvider()); debugViewer.setInput(DebugLevel.values()); debugViewer.getControl().setLayoutData(data); this.context.bindValue(ViewersObservables.observeSingleSelection(debugViewer), PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_DEBUG_LEVEL)); label = new Label(domainManagerGroup, SWT.NULL); label.setText("Arguments:"); text = new Text(domainManagerGroup, SWT.BORDER); text.setLayoutData(data); this.context.bindValue(SWTObservables.observeText(text, SWT.Modify), PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_ARGUMENTS)); final Group deviceManagerGroup = new Group(composite, SWT.NULL); deviceManagerGroup.setText("Device Manager"); deviceManagerGroup.setLayout(GridLayoutFactory.fillDefaults().create()); deviceManagerGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); deviceManagerGroup.setVisible(!this.sdrRoot.getNodesContainer().getNodes().isEmpty()); final CheckboxTreeViewer treeViewer = createTreeViewer(deviceManagerGroup); treeViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final Control buttonComposite = createSelectionButtons(deviceManagerGroup); buttonComposite.setLayoutData(GridDataFactory.fillDefaults().create()); context.bindSet(ViewersObservables.observeCheckedElements(treeViewer, DeviceConfiguration.class), nodes); // Insert a progress monitor this.progressMonitorPart = createProgressMonitorPart(composite, new GridLayout()); final GridData gridData = new GridData(GridData.FILL_HORIZONTAL); this.progressMonitorPart.setLayoutData(gridData); this.progressMonitorPart.setVisible(false); // Build the separator line final Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR); separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Dialog.applyDialogFont(composite); getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { try { LaunchDomainManagerWithOptionsDialog.this.run(true, true, scanForTakenDomainNames); updateButtonsEnableState(Status.OK_STATUS); } catch (final InvocationTargetException e) { SdrUiPlugin.getDefault().getLog().log( new Status(IStatus.ERROR, SdrUiPlugin.PLUGIN_ID, "Error scanning for domain names", e)); } catch (final InterruptedException e) { updateButtonsEnableState(Status.OK_STATUS); } } }); return composite; }
From source file:gov.redhawk.ide.sdr.ui.internal.handlers.LaunchDomainManagerWithOptionsDialog.java
License:Open Source License
@Override protected Composite createSelectionButtons(final Composite parent) { final Composite root = new Composite(parent, SWT.NULL); root.setLayout(new GridLayout(2, true)); final Control controls = super.createSelectionButtons(root); controls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Composite subContainer = new Composite(root, SWT.NONE); final GridLayout gridLayout = new GridLayout(2, false); subContainer.setLayout(gridLayout);/*from w w w.j av a 2s . c o m*/ subContainer.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Label label = new Label(subContainer, SWT.NULL); label.setText("Debug Level: "); final ComboViewer debugViewer = new ComboViewer(subContainer, SWT.READ_ONLY | SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER); debugViewer.setContentProvider(new ArrayContentProvider()); debugViewer.setInput(DebugLevel.values()); debugViewer.setSelection(new StructuredSelection("Info")); context.bindValue(ViewersObservables.observeSingleSelection(debugViewer), nodeDebugLevel); label = new Label(subContainer, SWT.NULL); label.setText("Arguments:"); Text text = new Text(subContainer, SWT.BORDER); text.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); this.context.bindValue(SWTObservables.observeText(text, SWT.Modify), nodeArguments, null, null); return root; }