public void createCombos(Composite parent) { parent.setLayout( GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(64, 10).create()); GridData comboGridData = new GridData(); comboGridData.widthHint = 100; Label label = new Label(parent, SWT.None); label.setText("Complex"); complexCombo = new Combo(parent, SWT.READ_ONLY); complexCombo.add("true"); complexCombo.add("false"); complexCombo.setToolTipText( "Flag to indicate data is complex. If true, data values assumed to be alternating real and complex float values."); complexCombo.setLayoutData(comboGridData); label = new Label(parent, SWT.None); label.setText("Loop"); loopCombo = new Combo(parent, SWT.READ_ONLY); loopCombo.add("true"); loopCombo.add("false"); // loopCombo.setEnabled(false); loopCombo.setToolTipText( "Do we continue to replay and loop over the input file when we are done or not"); loopCombo.setLayoutData(comboGridData); }
/** * Create contents of the wizard. * * @param parent */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(1, false)); Composite composite = new Composite(container, SWT.NONE); composite.setLayout(new GridLayout(2, false)); Label lblMetaModelThe = new Label(composite, SWT.NONE); GridData gd_lblMetaModelThe = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); gd_lblMetaModelThe.widthHint = 270; lblMetaModelThe.setLayoutData(gd_lblMetaModelThe); lblMetaModelThe.setText("Meta model the Helper conforms to:"); comboMM = new Combo(composite, SWT.NONE); GridData gd_comboMM = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_comboMM.widthHint = 330; comboMM.setLayoutData(gd_comboMM); Composite composite_1 = new Composite(container, SWT.NONE); composite_1.setLayout(new GridLayout(2, false)); Label lblMetaModelType = new Label(composite_1, SWT.NONE); GridData gd_lblMetaModelType = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); gd_lblMetaModelType.widthHint = 270; lblMetaModelType.setLayoutData(gd_lblMetaModelType); lblMetaModelType.setText("Meta model type of the input port:"); comboInput = new Combo(composite_1, SWT.NONE); comboInput.setEnabled(false); GridData gd_comboInput = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_comboInput.widthHint = 330; comboInput.setLayoutData(gd_comboInput); Composite composite_2 = new Composite(container, SWT.NONE); composite_2.setLayout(new GridLayout(2, false)); Label lblMetaModelType_1 = new Label(composite_2, SWT.NONE); GridData gd_lblMetaModelType_1 = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); gd_lblMetaModelType_1.widthHint = 270; lblMetaModelType_1.setLayoutData(gd_lblMetaModelType_1); lblMetaModelType_1.setText("Meta model type of the output port:"); comboOutput = new Combo(composite_2, SWT.NONE); comboOutput.setEnabled(false); GridData gd_comboOutput = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_comboOutput.widthHint = 330; comboOutput.setLayoutData(gd_comboOutput); setComboMM(); comboMM.setFocus(); comboMM.addListener(SWT.Modify, this); comboInput.addListener(SWT.Modify, this); comboOutput.addListener(SWT.Modify, this); this.setPageComplete(false); }
/* * (non-Javadoc) * @see it.baeyens.avreclipse.ui.editors.targets.AbstractTargetConfigurationEditorPart#createSectionContent * (org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit) */ @Override protected void createSectionContent(Composite parent, FormToolkit toolkit) { GridLayout layout = new GridLayout(2, false); layout.horizontalSpacing = 12; parent.setLayout(layout); // // The MCU Combo // toolkit.createLabel(parent, "MCU type:"); fMCUcombo = new Combo(parent, SWT.READ_ONLY); toolkit.adapt(fMCUcombo, true, true); fMCUcombo.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false)); fMCUcombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String mcuid = AVRMCUidConverter.name2id(fMCUcombo.getText()); getTargetConfiguration().setMCU(mcuid); refreshMessages(); getManagedForm().dirtyStateChanged(); } }); // // The FCPU Combo // toolkit.createLabel(parent, "MCU clock frequency:"); fFCPUcombo = new Combo(parent, SWT.NONE); toolkit.adapt(fFCPUcombo, true, true); fFCPUcombo.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false)); fFCPUcombo.setTextLimit(9); // max. 999 MHz fFCPUcombo.setToolTipText("Target Hardware Clock Frequency in Hz"); fFCPUcombo.setVisibleItemCount(FCPU_VALUES.length); fFCPUcombo.setItems(FCPU_VALUES); fFCPUcombo.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getTargetConfiguration().setFCPU(Integer.parseInt(fFCPUcombo.getText())); getManagedForm().dirtyStateChanged(); } }); // The verify listener to restrict the input to integers fFCPUcombo.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { String text = event.text; if (!text.matches("[0-9]*")) { event.doit = false; } } }); }
/** * Create contents of the wizard. * * @param parent */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(2, false)); Label lblChooseProject = new Label(container, SWT.NONE); lblChooseProject.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblChooseProject.setText("Choose project: "); project = new Combo(container, SWT.READ_ONLY); project.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { /* * set namespace combo to all namespaces in selected project */ ThinklabProject proj = ThinkScape.getProject(project.getText(), false); namespace.removeAll(); for (SemanticAnnotationContainer c : proj.getAnnotationNamespaces()) { namespace.add(c.getNamespace()); } } }); project.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblAnnotationNamespace = new Label(container, SWT.NONE); lblAnnotationNamespace.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblAnnotationNamespace.setText("Annotation namespace: "); namespace = new Combo(container, SWT.BORDER); namespace.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); boolean ex = false; for (ThinklabProject p : ThinkScape.getProjects()) { project.add(p.getName()); ex = true; } if (ex) { project.select(0); /* * set namespaces in combo */ ThinklabProject proj = ThinkScape.getProject(project.getText(), false); for (SemanticAnnotationContainer c : proj.getAnnotationNamespaces()) { namespace.add(c.getNamespace()); } } if (!ex) { project.setEnabled(false); namespace.setEnabled(false); this.setErrorMessage("No projects have been created. Create a project first."); } }
public void createControl(Composite parent) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 3; layout.verticalSpacing = 9; composite.setLayout(layout); Label label = new Label(composite, SWT.NULL); label.setText("&Project:"); comboProject = new Combo(composite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); comboProject.setLayoutData(gd); new Label(composite, SWT.NULL); label = new Label(composite, SWT.NULL); label.setText("&Language:"); comboLanguage = new Combo(composite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); comboLanguage.setLayoutData(gd); new Label(composite, SWT.NULL); label = new Label(composite, SWT.NULL); label.setText("&Feature:"); comboFeature = new Combo(composite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); comboFeature.setLayoutData(gd); new Label(composite, SWT.NULL); label = new Label(composite, SWT.NULL); label.setText("&Package:"); comboPackage = new Combo(composite, SWT.BORDER | SWT.SINGLE); comboPackage.setLayoutData(gd); new Label(composite, SWT.NULL); label = new Label(composite, SWT.NULL); label.setText("&Class name:"); comboClass = new Combo(composite, SWT.BORDER | SWT.SINGLE); comboClass.setLayoutData(gd); new Label(composite, SWT.NULL); labelModulename = new Label(composite, SWT.NULL); labelModulename.setText("&Module name:"); textModulename = new Text(composite, SWT.BORDER | SWT.SINGLE); textModulename.setLayoutData(gd); new Label(composite, SWT.NULL); labelRefines = new Label(composite, SWT.NULL); labelRefines.setText("&Refines:"); buttonRefines = new Button(composite, SWT.CHECK); gd = new GridData(GridData.BEGINNING); buttonRefines.setLayoutData(gd); initialize(); addListeners(); setControl(composite); dialogChanged(); }
protected void createServerSelectionControl(Composite parent) { Group group = new Group(parent, SWT.NONE); group.setText(PHPServerUIMessages.getString("ServerTab.server")); // $NON-NLS-1$ GridLayout ly = new GridLayout(1, false); ly.marginHeight = 0; ly.marginWidth = 0; group.setLayout(ly); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite phpServerComp = new Composite(group, SWT.NONE); phpServerComp.setLayout(new GridLayout(4, false)); phpServerComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); phpServerComp.setFont(parent.getFont()); Label label = new Label(phpServerComp, SWT.WRAP); GridData data = new GridData(GridData.BEGINNING); data.widthHint = 100; label.setLayoutData(data); label.setFont(parent.getFont()); label.setText(PHPServerUIMessages.getString("ServerLaunchConfigurationTab.0")); // $NON-NLS-1$ serverCombo = new Combo(phpServerComp, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); serverCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); serverCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleServerSelection(); } }); createNewServer = createPushButton( phpServerComp, PHPServerUIMessages.getString("ServerTab.new"), null); // $NON-NLS-1$ createNewServer.addSelectionListener(fListener); configureServers = createPushButton( phpServerComp, PHPServerUIMessages.getString("ServerTab.configure"), null); //$NON-NLS-1$ configureServers.addSelectionListener(fListener); servers = new ArrayList<Server>(); populateServerList(servers); // initialize the servers list if (!servers.isEmpty()) { for (int i = 0; i < servers.size(); i++) { Server svr = servers.get(i); serverCombo.add(svr.getName()); } } // select first item in list if (serverCombo.getItemCount() > 0) { serverCombo.select(0); } serverCombo.forceFocus(); }
private void createDropWidget(final Composite parent) { parent.setLayout(new FormLayout()); Combo combo = new Combo(parent, SWT.READ_ONLY); combo.setItems( new String[] { "Toggle Button", "Radio Button", "Checkbox", "Canvas", "Label", "List", "Table", "Tree", "Text" }); combo.select(LABEL); dropControlType = combo.getSelectionIndex(); dropControl = createWidget(dropControlType, parent, "Drop Target"); combo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { Object data = dropControl.getLayoutData(); Composite parent = dropControl.getParent(); dropControl.dispose(); Combo c = (Combo) e.widget; dropControlType = c.getSelectionIndex(); dropControl = createWidget(dropControlType, parent, "Drop Target"); dropControl.setLayoutData(data); updateDropTarget(); parent.layout(); } }); Button b = new Button(parent, SWT.CHECK); b.setText("DropTarget"); b.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { dropEnabled = ((Button) e.widget).getSelection(); updateDropTarget(); } }); b.setSelection(dropEnabled); FormData data = new FormData(); data.top = new FormAttachment(0, 10); data.bottom = new FormAttachment(combo, -10); data.left = new FormAttachment(0, 10); data.right = new FormAttachment(100, -10); dropControl.setLayoutData(data); data = new FormData(); data.bottom = new FormAttachment(100, -10); data.left = new FormAttachment(0, 10); combo.setLayoutData(data); data = new FormData(); data.bottom = new FormAttachment(100, -10); data.left = new FormAttachment(combo, 10); b.setLayoutData(data); updateDropTarget(); }
private void initComboTimezones(Composite parent) { comboViewer = new ComboViewer(this, SWT.READ_ONLY); Combo comboTimezones = comboViewer.getCombo(); comboTimezones.setToolTipText("Timezone"); comboTimezones.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboViewer.setContentProvider(ArrayContentProvider.getInstance()); comboViewer.setLabelProvider( new LabelProvider() { @Override public String getText(Object element) { if (element instanceof TimeZone) { return ((TimeZone) element).getID(); } return super.getText(element); } }); comboViewer.setInput(getAvailableTimezones()); comboViewer.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (comboViewer.getSelection() instanceof IStructuredSelection) { final IStructuredSelection selection = (IStructuredSelection) comboViewer.getSelection(); if (!(selection.isEmpty())) { final TimeZone seletedTimezone = (TimeZone) selection.getFirstElement(); calendarValue.setTimeZone(seletedTimezone); } } } }); }
private void getComboAttribute(Composite composite) { comboAttribute = new Combo(composite, SWT.READ_ONLY); comboAttribute.setText(Messages.getString("UpdateAttributeDialog.3")); // $NON-NLS-1$ comboAttribute.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); Object firstElement = selection.get(0); if (firstElement instanceof EObject) { AttributeConfiguration configuration = RequirementUtils.getAttributeConfiguration(((EObject) firstElement).eResource()); List<String> labelList = new ArrayList<String>(); for (ConfiguratedAttribute anAttribute : configuration.getListAttributes()) { labelList.add(anAttribute.getName()); comboAttribute.setData(anAttribute.getName(), anAttribute.getListValue()); } comboAttribute.setItems(labelList.toArray(new String[0])); comboAttribute.addSelectionListener(new AttributeSelectionListener()); comboAttribute.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent event) { attributeNameModified(); } }); } }
private void createRouterTypeControl(Composite parent) { // Label createLabel( parent, Messages.DiagramModelConnectionSection_0, ITabbedLayoutConstants.BIG_LABEL_WIDTH, SWT.CENTER); // Combo fComboRouterType = new Combo(parent, SWT.READ_ONLY); fComboRouterType.setItems(comboItems); fComboRouterType.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (isAlive()) { fIsExecutingCommand = true; getCommandStack() .execute( new ConnectionRouterTypeCommand( fDiagramModel, fComboRouterType.getSelectionIndex())); fIsExecutingCommand = false; } } }); GridData gd = new GridData(SWT.NONE, SWT.NONE, true, false); gd.minimumWidth = ITabbedLayoutConstants.COMBO_WIDTH; fComboRouterType.setLayoutData(gd); }
private void createPoolGroup(Composite comp, ValidationHandler validationHandler) { Group poolGroup; GridData gd; Label label; poolGroup = new Group(comp, SWT.SHADOW_NONE); poolGroup.setText("Pool"); poolGroup.setLayout(new GridLayout(2, false)); gd = new GridData(GridData.FILL_HORIZONTAL); poolGroup.setLayoutData(gd); label = new Label(poolGroup, SWT.NONE); label.setText("Target:"); targetCombo = new Combo(poolGroup, SWT.READ_ONLY); gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertHorizontalDLUsToPixels(180); targetCombo.setLayoutData(gd); for (Iterator i = targets.iterator(); i.hasNext(); ) { Target target = (Target) i.next(); targetCombo.add(target.toString()); } targetCombo.addModifyListener(validationHandler); label = new Label(poolGroup, SWT.NONE); label.setText("Pool ID:"); poolIdText = new Text(poolGroup, SWT.SINGLE | SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); poolIdText.setLayoutData(gd); poolIdText.addModifyListener(validationHandler); }
private Composite addOrderEntryChoices(Composite buttonComposite) { Label enterLabel = new Label(buttonComposite, SWT.NONE); enterLabel.setText(CodeInsertionDialog.insertionPoint); if (!enableInsertPosition) enterLabel.setEnabled(false); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); enterLabel.setLayoutData(gd); final Combo enterCombo = new Combo(buttonComposite, SWT.READ_ONLY); enterCombo.setVisibleItemCount(COMBO_VISIBLE_ITEM_COUNT); if (!enableInsertPosition) enterCombo.setEnabled(false); enterCombo.setItems(fLabels.toArray(new String[fLabels.size()])); enterCombo.select(currentPositionIndex); gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertWidthInCharsToPixels(60); enterCombo.setLayoutData(gd); enterCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int index = enterCombo.getSelectionIndex(); setInsertPosition(index); System.out.println(getElementPosition().toString()); } }); return buttonComposite; }
@Override protected Control createDialogArea(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(1, true)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); GridData gd = new GridData(GridData.FILL_BOTH); Label l1 = new Label(container, SWT.NONE); l1.setText(Messages.getString("CacheManagerDialog.1")); // $NON-NLS-1$ combo = new Combo(container, SWT.BORDER); combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); combo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { final String path = ((Combo) e.getSource()).getText(); viewer.getTable().removeAll(); // System.out.println(path); loadTable(new File(path)); } }); viewer = new TableViewer(container, SWT.BORDER | SWT.MULTI); viewer.getTable().setLayoutData(gd); loadData(); return container; }
private static void createIconCombo(Composite parent, final EmoticonImage icon) { Label label = new Label(parent, SWT.NONE); label.setText("Icon:"); final Combo combo = new Combo(parent, SWT.NONE); combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (icon.image != null) combo.setText(icon.image.path); combo.addListener( SWT.FocusIn, new Listener() { public void handleEvent(Event event) { if (combo.getItemCount() > 0) return; inGuiSetCommand = true; for (ImageFile file : mep.images) combo.add(file.path); inGuiSetCommand = false; } }); DelayedListener listener = new DelayedListener( new Listener() { public void handleEvent(Event e) { if (combo.getText().trim().length() <= 0) icon.image = null; else icon.image = mep.createTemporaryImage(combo.getText(), icon.protocol); fillFramesHolder(icon, false); } }); combo.addListener(SWT.Selection, listener.fast()); combo.addListener(SWT.Modify, listener.delayed()); }
public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); // do stuff like layout et al composite.setLayout(new GridLayout()); new Label(composite, SWT.NONE).setText(Messages.RSALoadKeypairPage_select_keypair_from_list); combo = new Combo(composite, SWT.READ_ONLY); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); combo.setItems(keyStoreItems.keySet().toArray(new String[keyStoreItems.size()])); combo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { privateAlias = keyStoreItems.get(combo.getText()); publicAlias = getPublicForPrivate(); checkComplete(); } }); new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL) .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Text l = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY); l.setText(Messages.RSALoadKeypairPage_enter_password); l.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); passfield = new Text(composite, SWT.BORDER | SWT.PASSWORD); passfield.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); passfield.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { checkComplete(); } }); setControl(composite); }
/** * Creates the control. * * @param parent The parent composite * @return The created control */ public Control createControl(Composite parent) { _group = new Group(parent, SWT.NONE); _group.setFont(parent.getFont()); _group.setLayout(_wizardPage.initGridLayout(new GridLayout(2, false), true)); _group.setText(Messages.NewBlackBerryProjectWizardPageOne_JREGroup_title); _useProjectRE.doFillIntoGrid(_group, 1); Combo comboControl = _RECombo.getComboControl(_group); comboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); Control[] controls = _useDefaultRE.doFillIntoGrid(_group, 1); // Fixed IDT 233814, make sure there is enough room to display the label if user change // default JRE from java to BB GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; gd.minimumWidth = 260; controls[0].setLayoutData(gd); _preferenceLink = new Link(_group, SWT.NONE); _preferenceLink.setFont(_group.getFont()); _preferenceLink.setText(Messages.NewBlackBerryProjectWizardPageOne_JREGroup_link_description); _preferenceLink.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); _preferenceLink.addSelectionListener(this); setDefaultButtonState(); return _group; }
/** @param args ; */ public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); final Combo combo = new Combo(shell, SWT.READ_ONLY); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Button button = new Button(shell, SWT.PUSH); button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); button.setText("OK"); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { CustomMatchConditionDialog dialog = new CustomMatchConditionDialog(shell); int res = dialog.open(); if (res == CustomMatchConditionDialog.OK) {} } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
/** Create contents of the dialog. */ private void createContents() { shell = new Shell(getParent()); shell.setSize(334, 100); shell.setText(getText()); shell.setLayout(new GridLayout(2, false)); combo = new Combo(shell, SWT.READ_ONLY); combo.setItems(options); combo.select(0); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); Button btnNewButton = new Button(shell, SWT.NONE); btnNewButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { result = combo.getText(); shell.close(); } }); btnNewButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); btnNewButton.setText("Select"); Button btnNewButton_1 = new Button(shell, SWT.NONE); btnNewButton_1.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { result = null; shell.close(); } }); btnNewButton_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); btnNewButton_1.setText("Cancel"); }
public void createControl(Composite parent) { Font font = parent.getFont(); Group group = new Group(parent, SWT.NONE); group.setText("Browser:"); GridData gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd); GridLayout layout = new GridLayout(); layout.numColumns = 1; group.setLayout(layout); group.setFont(font); vjoBrowserType = new Combo(group, SWT.READ_ONLY); vjoBrowserType.add("IE"); // IE_6P vjoBrowserType.add("FIREFOX"); // Firefox_1P vjoBrowserType.select(0); gd = new GridData(GridData.FILL_HORIZONTAL); vjoBrowserType.setLayoutData(gd); vjoBrowserType.setFont(font); SelectionListener listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } }; vjoBrowserType.addSelectionListener(listener); }
public void createProjectControls(Composite parent, int nColumns) { Label locationLabel = new Label(parent, SWT.NONE); locationLabel.setText("Project:"); locationLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); projectCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY); GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false); data.horizontalSpan = 2; projectCombo.setLayoutData(data); projectCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { projectText = projectCombo.getText(); projectChanged(); } }); gwtProjects = Util.getGwtProjects(); for (int i = 0; i < gwtProjects.length; i++) { IJavaProject gwtProject = gwtProjects[i]; String name = gwtProject.getProject().getName(); projectCombo.add(name); if (name.equals(selectedProject)) projectCombo.select(i); } if (projectCombo.getSelectionIndex() == -1) projectCombo.select(0); new Label(parent, SWT.NONE); }
@Override protected void createFieldEditors() { // TODO Auto-generated method stub Composite container = (Composite) this.getControl(); addField( new BooleanFieldEditor( BTSCorpusConstants.PREF_LEMMA_NAVIGATOR_SORTBYKEY, "Lemma Navigator sort by sort key", BooleanFieldEditor.DEFAULT, getFieldEditorParent())); context = StaticAccessController.getContext(); configurationController = context.get(PassportConfigurationController.class); Label lblVisibility = new Label(container, SWT.NONE); lblVisibility.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); lblVisibility.setText("Default Visibility"); visibilityCMB_Admin = new Combo(container, SWT.READ_ONLY); visibilityCMB_Admin.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false, 3, 1)); visibility_viewer = new ComboViewer(visibilityCMB_Admin); AdapterFactoryLabelProvider labelProvider_vis = new AdapterFactoryLabelProvider(factory); AdapterFactoryContentProvider contentProvider_vis = new AdapterFactoryContentProvider(factory); visibility_viewer.setContentProvider(contentProvider_vis); visibility_viewer.setLabelProvider(labelProvider_vis); visibility_viewer.setInput( configurationController.getVisibilityConfigItemProcessedClones(null)); Label lblRevisionState = new Label(container, SWT.NONE); lblRevisionState.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); lblRevisionState.setText("Default Review State"); reviewCMB_Admin = new Combo(container, SWT.READ_ONLY); reviewCMB_Admin.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false, 3, 1)); reviewState_viewer = new ComboViewer(reviewCMB_Admin); AdapterFactoryLabelProvider labelProvider_rev = new AdapterFactoryLabelProvider(factory); AdapterFactoryContentProvider contentProvider_rev = new AdapterFactoryContentProvider(factory); reviewState_viewer.setContentProvider(contentProvider_rev); reviewState_viewer.setLabelProvider(labelProvider_rev); reviewState_viewer.setInput( configurationController.getReviewStateConfigItemProcessedClones(null)); init(); container.layout(); }
private void getSettings(Composite parent) { // Style combo Label label = new Label(parent, SWT.NONE); label.setText("Style:"); final Combo styleCombo = new Combo(parent, SWT.READ_ONLY); styleCombo.setItems(new String[] {"Blue", "Green", "Black"}); styleCombo.select(0); styleCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (styleCombo.getText().equals("Blue")) { ((ResultAndNavigationPageGraphicsRenderer) pageableTable.getCompositeTop()) .getNavigationPage() .setConfigurator(BlueNavigationPageGraphicsConfigurator.getInstance()); } else if (styleCombo.getText().equals("Green")) { ((ResultAndNavigationPageGraphicsRenderer) pageableTable.getCompositeTop()) .setConfigurator(GreenNavigationPageGraphicsConfigurator.getInstance()); } else { ((ResultAndNavigationPageGraphicsRenderer) pageableTable.getCompositeTop()) .setConfigurator(BlackNavigationPageGraphicsConfigurator.getInstance()); } } }); styleCombo.setLayoutData(new GridData(GridData.FILL_BOTH)); // Locale Label localeLabel = new Label(parent, SWT.NONE); localeLabel.setText("Locale:"); localeLabel.setLayoutData(new GridData()); final Combo localeCombo = new Combo(parent, SWT.READ_ONLY); localeCombo.setItems(new String[] {"en", "fr"}); localeCombo.select(Locale.getDefault().equals(Locale.FRANCE) ? 1 : 0); localeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); localeCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String locale = localeCombo.getText(); if ("fr".equals(locale)) { pageableTable.setLocale(Locale.FRENCH); } else { pageableTable.setLocale(Locale.ENGLISH); } } }); }
/** * Creates the encoding component * * @param parent the parent to add this composite to */ private void createEncodingComponent(Composite parent) { Group group = SWTFactory.createGroup( parent, LaunchConfigurationsMessages.CommonTab_1, 2, 1, GridData.FILL_BOTH); fDefaultEncodingButton = createRadioButton(group, IInternalDebugCoreConstants.EMPTY_STRING); GridData gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false); gd.horizontalSpan = 2; fDefaultEncodingButton.setLayoutData(gd); fAltEncodingButton = createRadioButton(group, LaunchConfigurationsMessages.CommonTab_3); fAltEncodingButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); fEncodingCombo = new Combo(group, SWT.NONE); fEncodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fEncodingCombo.setFont(parent.getFont()); List allEncodings = IDEEncoding.getIDEEncodings(); String[] encodingArray = (String[]) allEncodings.toArray(new String[0]); fEncodingCombo.setItems(encodingArray); if (encodingArray.length > 0) { fEncodingCombo.select(0); } fEncodingCombo .getAccessible() .addAccessibleListener( new AccessibleAdapter() { public void getName(AccessibleEvent e) { e.result = LaunchConfigurationsMessages.CommonTab_3; } }); SelectionListener listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (e.getSource() instanceof Button) { Button button = (Button) e.getSource(); if (button.getSelection()) { updateLaunchConfigurationDialog(); fEncodingCombo.setEnabled(fAltEncodingButton.getSelection() == true); } } else { updateLaunchConfigurationDialog(); } } }; fAltEncodingButton.addSelectionListener(listener); fDefaultEncodingButton.addSelectionListener(listener); fEncodingCombo.addSelectionListener(listener); fEncodingCombo.addKeyListener( new KeyAdapter() { /* * (non-Javadoc) * * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent) */ public void keyReleased(KeyEvent e) { scheduleUpdateJob(); } }); }
/** * Creates an endpoint type component consisting of label and combo box. Also adds a selection * listener to combo box. * * @param container */ private void createEndptTypeComponent(Composite container) { Label lblType = new Label(container, SWT.LEFT); GridData gridData = new GridData(); gridData.horizontalIndent = 10; lblType.setLayoutData(gridData); lblType.setText(Messages.adRolType); comboType = new Combo(container, SWT.READ_ONLY); gridData = new GridData(); gridData.horizontalAlignment = GridData.END; gridData.grabExcessHorizontalSpace = true; gridData.widthHint = 60; comboType.setLayoutData(gridData); comboType.setItems(arrType); comboType.setText(arrType[0]); final Combo comboTemp = comboType; comboType.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { if (comboTemp .getText() .equalsIgnoreCase(WindowsAzureEndpointType.Internal.toString())) { txtPublicPort.setText(""); txtPublicPort.setEnabled(false); lblPublicPort.setEnabled(false); } else if (comboTemp .getText() .equalsIgnoreCase(WindowsAzureEndpointType.Input.toString())) { txtPublicPort.setEnabled(true); lblPublicPort.setEnabled(true); String port = txtPublicPort.getText(); if (port.contains("-")) { txtPublicPort.setText(port.split("-")[0]); } else { try { Integer.parseInt(port); } catch (Exception e) { port = txtPrivatePort.getText(); } txtPublicPort.setText(port); } } else { txtPublicPort.setEnabled(true); lblPublicPort.setEnabled(true); if (!txtPublicPort.getText().isEmpty() && txtPrivatePort.getText().isEmpty()) { if (!txtPublicPort.getText().contains("-")) { txtPublicPort.setText( txtPublicPort.getText().concat("-").concat(txtPublicPort.getText())); } txtPrivatePort.setText(txtPublicPort.getText().split("-")[0]); } else if (txtPublicPort.getText().isEmpty()) { txtPublicPort.setText(txtPrivatePort.getText()); } } } }); }
protected Control createDialogArea(final Composite parent) { Composite container = new Composite(parent, SWT.None); GridLayout layout = new GridLayout(); layout.numColumns = 1; container.setLayout(layout); Group group = new Group(container, SWT.None); group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); layout = new GridLayout(); layout.numColumns = 2; group.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); container.setLayoutData(gd); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; new Label(group, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(gd); Label urlLabel = new Label(group, SWT.NONE); GridData gd_urlLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_urlLabel.widthHint = 100; urlLabel.setLayoutData(gd_urlLabel); urlLabel.setText("URL "); Text urlText = new Text(group, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); urlText.setLayoutData(gd); urlText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent event) { Text url = (Text) event.widget; serverUrl = url.getText(); setServerUrl(serverUrl); } }); Label pathLabel = new Label(group, SWT.NONE); pathLabel.setText("Path "); urlText.setText("https://localhost:9443"); pathText = new Combo(group, SWT.NONE); pathText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent arg0) { updateSelectedPath(); } }); pathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); pathText.removeAll(); List<String> defaultPaths = getDefaultPaths(); for (String path : defaultPaths) { pathText.add(path); } pathText.select(getDefaultPathId()); updateSelectedPath(); return super.createDialogArea(parent); }
public Control createControl(Composite composite) { packagingGroup = new Group(composite, SWT.NONE); packagingGroup.setFont(composite.getFont()); packagingGroup.setText("Packaging Provider"); packagingGroup.setLayout(initGridLayout(new GridLayout(2, false), true)); builtinButton = new Button(packagingGroup, SWT.RADIO); builtinButton.setText("Select a built-in provider"); builtinButton.setSelection(true); builtinButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { packagingProviderCombo.setEnabled(true); packagingProviderText.setEnabled(false); } }); GridDataFactory.fillDefaults().span(2, 1).applyTo(builtinButton); Label options = new Label(packagingGroup, SWT.WRAP); options.setText("Packaging: "); GridDataFactory.swtDefaults().indent(5, 0).applyTo(options); packagingProviderCombo = new Combo(packagingGroup, SWT.DROP_DOWN | SWT.READ_ONLY); packagingProviderCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); packagingProviderCombo.setEnabled(true); List<String> provider = new ArrayList<String>(); provider.add("JAR"); provider.add("BUNDLE"); provider.add("POM"); provider.add("WAR"); packagingProviderCombo.setItems(provider.toArray(new String[provider.size()])); packagingProviderCombo.select(0); customButton = new Button(packagingGroup, SWT.RADIO); customButton.setText("Specify a custom provider"); customButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { packagingProviderCombo.setEnabled(false); packagingProviderText.setEnabled(true); } }); GridDataFactory.fillDefaults().span(2, 1).applyTo(customButton); Label flag = new Label(packagingGroup, SWT.WRAP); flag.setText("--provider "); GridDataFactory.swtDefaults().indent(5, 0).applyTo(flag); packagingProviderText = new Text(packagingGroup, SWT.BORDER); packagingProviderText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); packagingProviderText.setEnabled(false); updateEnablement(); packagingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); return packagingGroup; }
private void createUICategoryCombo(Composite parent) { int style = SWT.READ_ONLY | SWT.BORDER; fCategoryCombo = new Combo(parent, style); GridData data = new GridData(GridData.FILL_HORIZONTAL); fCategoryCombo.setLayoutData(data); fCategoryCombo.add(CSWizardMessages.RegisterCSWizardPage_none); fCategoryCombo.setText(CSWizardMessages.RegisterCSWizardPage_none); }
/** * @see * org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite) * @since 5.5.3 */ @SuppressWarnings("unused") @Override protected Control createDialogArea(Composite parent) { Composite pnlOuter = (Composite) super.createDialogArea(parent); Composite panel = new Composite(pnlOuter, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; panel.setLayout(gridLayout); panel.setLayoutData(new GridData(GridData.FILL_BOTH)); // set title setTitle(UTIL.getString(PREFIX + "title")); // $NON-NLS-1$ setMessage(UTIL.getString(PREFIX + "initialMessage")); // $NON-NLS-1$ // Group serversGroup = WidgetFactory.createGroup(panel, UTIL.getString(PREFIX + // "teiidServers"), GridData.FILL_BOTH, 2, 2); //$NON-NLS-1$ // GridData gd = new GridData(GridData.FILL_HORIZONTAL); // gd.horizontalSpan = 2; // serversGroup.setLayoutData(gd); ACTION_COMBO: { serversCombo = new Combo(panel, SWT.NONE | SWT.READ_ONLY); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; serversCombo.setLayoutData(gd); serversCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent ev) { selectedServer = null; String serverName = serversCombo.getItem(serversCombo.getSelectionIndex()); Collection<ITeiidServer> teiidServers = DqpPlugin.getInstance().getServerManager().getServers(); for (ITeiidServer teiidServer : teiidServers) { if (teiidServer.getCustomLabel().equalsIgnoreCase(serverName)) { selectedServer = teiidServer; break; } } updateState(); } }); Collection<ITeiidServer> teiidServers = DqpPlugin.getInstance().getServerManager().getServers(); List<String> nameList = new ArrayList<String>(); for (ITeiidServer teiidServer : teiidServers) { nameList.add(teiidServer.getCustomLabel()); } WidgetUtil.setComboItems(serversCombo, nameList, null, true); } return panel; }
@Override public void createControl(Composite parent) { Composite controls = new Composite(parent, SWT.FILL); controls.setLayout(new FormLayout()); Label label = new Label(controls, SWT.LEFT); label.setText("Available launch configurations: "); FormData f = new FormData(); f.left = new FormAttachment(0, 5); f.top = new FormAttachment(0, 5); label.setLayoutData(f); availableConfigsCombo = new Combo(controls, SWT.LEFT | SWT.READ_ONLY); f = new FormData(); f.left = new FormAttachment(label, 5); f.right = new FormAttachment(100, -100); f.top = new FormAttachment(0, 5); availableConfigsCombo.setLayoutData(f); add = new Button(controls, SWT.PUSH); add.setText("Add"); add.setEnabled(false); f = new FormData(); f.left = new FormAttachment(availableConfigsCombo, 5); f.right = new FormAttachment(100, -5); f.top = new FormAttachment(0, 4); add.setLayoutData(f); Label selectiosLabel = new Label(controls, SWT.LEFT); f = new FormData(); f.left = new FormAttachment(0, 5); f.top = new FormAttachment(availableConfigsCombo, 5); selectiosLabel.setLayoutData(f); selectiosLabel.setText("Selected launch configurations:"); selectedConfigsList = new org.eclipse.swt.widgets.List( controls, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI); f = new FormData(); f.left = new FormAttachment(label, 5); f.right = new FormAttachment(100, -5); f.top = new FormAttachment(availableConfigsCombo, 5); f.bottom = new FormAttachment(100, -35); selectedConfigsList.setLayoutData(f); delete = new Button(controls, SWT.PUSH); delete.setText("Remove"); f = new FormData(); f.left = new FormAttachment(100, -100); f.right = new FormAttachment(100, -5); f.top = new FormAttachment(selectedConfigsList, 5); delete.setLayoutData(f); delete.setEnabled(false); addListenerrs(); setControl(controls); }
public static Combo createLabelCombo(Composite parent, String label, int style) { Label labelControl = createControlLabel(parent, label); // labelControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Combo combo = new Combo(parent, style); combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); return combo; }