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); }
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); }
private void initialSettings() { action = 1; comboKateg_.setItems(dB.getComboItemsFromDB("as_asset_type")); comboKateg_.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // TODO Auto-generated method stub // System.out.println(comboKateg_.getSelectionIndex()); int index = comboKateg_.getSelectionIndex() + 1; comboPodkateg_.setEnabled(true); // if(comboKateg_.getText()!="") // comboPodkateg_.setText(getTextFromDB("as_subcateg", "WHERE assubcateg_id // ="+comboKateg_.getText().substring(0,2)+10+"")); comboPodkateg_.setItems( dB.getComboItemsFromDB("as_subcateg", "WHERE assubcateg_id LIKE '" + index + "%'")); } }); comboNoisteljorgjed_.setItems(dB.getComboItemsFromDB("as_owner")); comboPovjerljivost_.setItems(dB.getComboItemsFromDB("as_confidentiality")); comboCjelovitost_.setItems(dB.getComboItemsFromDB("as_integrity")); comboRaspolozivost_.setItems(dB.getComboItemsFromDB("as_accessibility", "Combo")); comboBi_.setItems(dB.getComboItemsFromDB("as_business_impact")); }
/** Create contents of the dialog. */ private void createContents() { shell = new Shell(getParent(), getStyle()); shell.setLocation(location); shell.setSize(132, 85); shell.setText(getText()); final Combo combo = new Combo(shell, SWT.NONE); combo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { System.out.println(combo.getItem(combo.getSelectionIndex())); MSA structure = worksheet_.getStructure(); int no = Integer.parseInt(combo.getItem(combo.getSelectionIndex())); try { element_.setMaterial(structure.getMaterialByNo(no)); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } shell.dispose(); } }); combo.setBounds(0, 0, 100, 40); for (Material material : this.worksheet_.getStructure().getMaterials()) { combo.add(String.valueOf(material.getNo())); } // combo.add("1223"); // combo.add("343"); // combo.setBounds(20, 10, 88, 23); }
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); }
/* * (non-Javadoc) * @see org.eclipse.ui.dialogs.WizardNewProjectCreationPage#createControl(org.eclipse.swt.widgets.Composite) */ @Override public void createControl(Composite parent) { super.createControl(parent); Composite control = (Composite) getControl(); Group group = new Group(control, SWT.NONE); group.setLayout(new GridLayout(2, false)); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setText(Messages.PHPDevelopmentPage_compatibility); Label label = new Label(group, SWT.NONE); label.setText(Messages.PHPDevelopmentPage_phpVersion); fPHPVersions = new Combo(group, SWT.BORDER | SWT.READ_ONLY | SWT.DROP_DOWN); fPHPVersions.setItems( PHPVersionConfigurationBlock.PHP_VERSION_NAMES.toArray( new String[PHPVersionConfigurationBlock.PHP_VERSION_NAMES.size()])); selectedAlias = PHPVersion.getLatest().getAlias(); setSelectedVersion(selectedAlias); // Update the 'selectedAlias' on combo selection changes. // We do that to avoid a 'widget dispose' errors when accessing this field after the page was // disposed. fPHPVersions.addSelectionListener( new SelectionListener() { public void widgetSelected(SelectionEvent e) { selectedAlias = PHPVersionConfigurationBlock.PHP_ALIASES.get(fPHPVersions.getSelectionIndex()); } public void widgetDefaultSelected(SelectionEvent e) {} }); Dialog.applyDialogFont(control); setControl(control); }
@Override public void createPartControl(Composite parent) { Composite body = new Composite(parent, SWT.NONE); body.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); body.setLayout(new GridLayout()); Account account = getAccount(); intervalReport = new TimeIntervalReport( account, TimeIntervalReport.Interval.DAY, PriceProviderFactory.getInstance()); intervalReport.addPropertyChangeListener(changeListener); String chartType = StringUtils.defaultString(account.getConfigurationValue(CHART_TYPE), "all"); JFreeChart chart = createChart(chartType); chartFrame = new ChartComposite(body, SWT.NONE, chart, true); chartFrame.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); displayType = new Combo(body, SWT.READ_ONLY); for (TimeChart.RANGE r : TimeChart.RANGE.values()) { displayType.add(r.getName()); } displayType.setText(chartType); displayType.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Combo c = (Combo) e.getSource(); String type = c.getItem(c.getSelectionIndex()); timeChart.setChartType(type); dirty = true; firePropertyChange(IEditorPart.PROP_DIRTY); } }); }
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(); }
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(); }
/** * Creates a combo box and associates the combo data with the combo box. * * @param composite the composite to create the combo box in * @param key the unique key to identify the combo box * @param values the values represented by the combo options * @param valueLabels the values displayed in the combo box * @return the generated combo box */ protected Combo newComboControl( Composite composite, String key, int[] values, String[] valueLabels) { ComboData data = new ComboData(key, values, -1); Combo comboBox = new Combo(composite, SWT.READ_ONLY); comboBox.setItems(valueLabels); comboBox.setData(data); comboBox.addSelectionListener(getSelectionListener()); comboBox.setFont(JFaceResources.getDialogFont()); makeScrollableCompositeAware(comboBox); int severity = -1; if (key != null) severity = fPreferencesService.getInt( getPreferenceNodeQualifier(), key, ValidationMessage.WARNING, createPreferenceScopes()); if (severity == ValidationMessage.ERROR || severity == ValidationMessage.WARNING || severity == ValidationMessage.IGNORE) { data.setSeverity(severity); data.originalSeverity = severity; } if (data.getIndex() >= 0) comboBox.select(data.getIndex()); fCombos.add(comboBox); return comboBox; }
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.verticalSpacing = 1; container.setLayout(layout); container.setLayoutData(new GridData(GridData.FILL_BOTH)); super.createControl(container); Label categoryLabel = new Label(container, SWT.NONE); categoryCb = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY); categoryLabel.setText(BundleInternationalization.getString("CategoryLabel") + ":"); String[] items = new String[Categories.values().length]; for (int i = 0; i < Categories.values().length; i++) items[i] = Categories.values()[i].name(); categoryCb.setItems(items); categoryCb.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { wizardChanged(); } }); container.layout(); wizardChanged(); }
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); }
@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 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; }
/** * Creates and returns the control for this contribution item under the given parent composite. * * @param parent the parent composite * @return the new control */ protected Control createControl(final Composite parent) { combo = new Combo(parent, SWT.DROP_DOWN); combo.addSelectionListener( new SelectionListener() { public void widgetSelected(final SelectionEvent e) { handleWidgetSelected(e); } public void widgetDefaultSelected(final SelectionEvent e) { handleWidgetDefaultSelected(e); } }); combo.addFocusListener( new FocusListener() { public void focusGained(final FocusEvent e) { // do nothing } public void focusLost(final FocusEvent e) { refresh(false); } }); // Initialize width of combo combo.setItems(initStrings); toolitem.setWidth(computeWidth(combo)); combo.setToolTipText("Current concern"); refresh(true); return combo; }
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 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 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()); } } } }); }
/** * 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(); } }); }
/** * @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; }
/* * (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; } } }); }
@Override public void createControl(Composite parent) { mComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginWidth = layout.marginHeight = 0; mComposite.setLayout(layout); GridDataFactory.fillDefaults().grab(true, true).applyTo(mComposite); Label l = new Label(mComposite, SWT.NONE); l.setText("Size: "); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(l); mSizeLabel = new Label(mComposite, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(mSizeLabel); l = new Label(mComposite, SWT.NONE); l.setText("Usage: "); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(l); mUsageLabel = new Label(mComposite, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(mUsageLabel); l = new Label(mComposite, SWT.NONE); l.setText("Type: "); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(l); mTypeLabel = new Label(mComposite, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(mTypeLabel); l = new Label(mComposite, SWT.NONE); l.setText("Format Data As: "); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(l); DisplayFormat[] values = DisplayFormat.values(); List<String> formats = new ArrayList<String>(values.length); for (DisplayFormat format : values) { formats.add(format.name()); } mDisplayFormatCombo = new Combo(mComposite, SWT.DROP_DOWN | SWT.READ_ONLY); mDisplayFormatCombo.setItems(formats.toArray(new String[formats.size()])); mDisplayFormatCombo.select(0); mDisplayFormatCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateContents(); } }); GridDataFactory.fillDefaults().grab(true, false).applyTo(mDisplayFormatCombo); mTextControl = new Text( mComposite, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL); GridDataFactory.fillDefaults().span(2, 1).grab(true, true).applyTo(mTextControl); mTextControl.setEditable(false); }
public KontaktImporterBlatt(final Composite parent) { super(parent, SWT.NONE); setLayout(new GridLayout(2, false)); new Label(this, SWT.NONE).setText(Messages.KontaktImporterBlatt_DateiTyp); new Label(this, SWT.NONE).setText(Messages.KontaktImporterBlatt_Datei); cbMethods = new Combo(this, SWT.SINGLE); cbMethods.setItems(methods); cbMethods.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent arg0) { method = cbMethods.getSelectionIndex(); } }); cbMethods.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); Button bLoad = new Button(this, SWT.PUSH); bLoad.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { FileDialog fd = new FileDialog(getShell(), SWT.OPEN); String file = fd.open(); lbFileName.setText(file == null ? "" : file); // $NON-NLS-1$ filename = lbFileName.getText(); } }); bLoad.setText(Messages.KontaktImporterBlatt_ChoseFile); lbFileName = new Label(this, SWT.NONE); bLoad.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); lbFileName.setText(Messages.KontaktImporterBlatt_PleaseChooseTypeAndFile); lbFileName.setLayoutData(SWTHelper.getFillGridData(2, true, 1, true)); final Button btnMediportInsuranceList = new Button(this, SWT.CHECK); btnMediportInsuranceList.setText(Messages.KontaktImporterBlatt_MediportInsurer); btnMediportInsuranceList.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false)); btnMediportInsuranceList.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mediportInsuererList = btnMediportInsuranceList.getSelection(); } }); final Button bKeep = new Button(this, SWT.CHECK); bKeep.setText(Messages.KontaktImporterBlatt_KeepID); bKeep.setLayoutData(SWTHelper.getFillGridData(2, true, 1, true)); bKeep.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { bKeepID = bKeep.getSelection(); } }); }
/** * 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."); } }
@Test public void testFireDefaultSelectionEvent() { SelectionListener listener = mock(SelectionListener.class); combo.addSelectionListener(listener); Fixture.fakeNotifyOperation(getId(combo), ClientMessageConst.EVENT_DEFAULT_SELECTION, null); Fixture.readDataAndProcessAction(combo); verify(listener, times(1)).widgetDefaultSelected(any(SelectionEvent.class)); }
/** * Create an area of more transplant difficulty.<br> * * @param checkItemGroup Group */ private void makeDegreeDetailArea(Group checkItemGroup) { Label degreeDetail = new Label(checkItemGroup, SWT.NULL); degreeDetail.setText(ResourceUtil.degreeDetail); degreeDetail.setLayoutData(ControlUtil.getTopGridData()); degreeDetailCombo = new Combo(checkItemGroup, SWT.READ_ONLY); ControlUtil.addComboBoxItem(DegreeDetailEnum.values(), degreeDetailCombo); degreeDetailCombo.setLayoutData(ControlUtil.getTopGridData()); degreeDetailCombo.addSelectionListener(new DirtyListener(super.getEditor())); }
/** * Create an area of transplant difficulty.<br> * * @param checkItemGroup Group */ private void makePortabilityDegreeArea(Group checkItemGroup) { Label portabilityDegree = new Label(checkItemGroup, SWT.NULL); portabilityDegree.setText(ResourceUtil.portabilityDegree); portabilityDegree.setLayoutData(ControlUtil.getTopGridData()); portabilityDegreeCombo = new Combo(checkItemGroup, SWT.READ_ONLY); ControlUtil.addComboBoxItem(PortabilityDegreeEnum.values(), portabilityDegreeCombo); portabilityDegreeCombo.setLayoutData(ControlUtil.getTopGridData()); portabilityDegreeCombo.addSelectionListener(new DirtyListener(super.getEditor())); }
public void setVersionSelectionListener(final VersionSelectionChangeListener listener) { versionSelectionListener = listener; versionCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fireVersionSelectionChanged(); } }); }
/** This method initializes main controls of the main window */ private void initControlsArea( final Composite controlsArea, final Combo feederSelectionCombo, final Button startStopButton, final StartStopScanningAction startStopScanningAction, final ToolsActions.Preferences preferencesListener, final ToolsActions.ChooseFetchers chooseFetchersListsner) { controlsArea.setLayoutData( LayoutHelper.formData( new FormAttachment(feederArea), new FormAttachment(100), new FormAttachment(0), new FormAttachment(feederArea, 0, SWT.BOTTOM))); controlsArea.setLayout(LayoutHelper.formLayout(7, 3, 3)); // steal the height from the second child of the FeederGUI - this must be the first edit box. // this results in better visual alignment with FeederGUIs Control secondControl = feederRegistry.current().getChildren()[1]; // initialize global standard button height buttonHeight = secondControl.getSize().y + 2; // feeder selection combobox this.feederSelectionCombo = feederSelectionCombo; feederSelectionCombo.pack(); IPFeederSelectionListener feederSelectionListener = new IPFeederSelectionListener(); feederSelectionCombo.addSelectionListener(feederSelectionListener); // initialize the selected feeder GUI feederSelectionCombo.select(guiConfig.activeFeeder); feederSelectionCombo.setToolTipText(Labels.getLabel("combobox.feeder.tooltip")); // start/stop button this.startStopButton = startStopButton; shell.setDefaultButton(startStopButton); startStopButton.addSelectionListener(startStopScanningAction); // traverse the button before the combo (and don't traverse other buttons at all) controlsArea.setTabList(new Control[] {startStopButton, feederSelectionCombo}); prefsButton = new ToolBar(controlsArea, SWT.FLAT); prefsButton.setCursor(prefsButton.getDisplay().getSystemCursor(SWT.CURSOR_HAND)); ToolItem item = new ToolItem(prefsButton, SWT.PUSH); item.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.preferences.img"))); item.setToolTipText(Labels.getLabel("title.preferences")); item.addListener(SWT.Selection, preferencesListener); fetchersButton = new ToolBar(controlsArea, SWT.FLAT); fetchersButton.setCursor(fetchersButton.getDisplay().getSystemCursor(SWT.CURSOR_HAND)); item = new ToolItem(fetchersButton, SWT.PUSH); item.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.fetchers.img"))); item.setToolTipText(Labels.getLabel("title.fetchers.select")); item.addListener(SWT.Selection, chooseFetchersListsner); feederSelectionListener.widgetSelected(null); }
/* * (non-Javadoc) * * @see * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets * .Composite) */ @Override protected Control createDialogArea(Composite parent) { final int gridDataSizeSubtrahend = 20; Composite comp = (Composite) super.createDialogArea(parent); Label dirLabel = new Label(comp, SWT.NONE); dirLabel.setText(Messages.IconSelectDialog_5); dirCombo = new Combo(comp, SWT.VERTICAL | SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY); GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false); dirCombo.setLayoutData(gd); dirCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { dirComboModel.setSelectedIndex(dirCombo.getSelectionIndex()); directory = dirComboModel.getSelectedObject(); loadIcons(directory.getPath()); } }); showComboValues(); Group group = new Group(comp, SWT.NONE); group.setText(Messages.IconSelectDialog_6); GridLayout groupOrganizationLayout = new GridLayout(1, true); group.setLayout(groupOrganizationLayout); gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.minimumWidth = SIZE_Y - gridDataSizeSubtrahend; gd.heightHint = SIZE_X - gridDataSizeSubtrahend; group.setLayoutData(gd); createTable(group); group.layout(); final Button defaultCheckbox = new Button(comp, SWT.CHECK); defaultCheckbox.setText(Messages.IconSelectDialog_7); defaultCheckbox.setSelection(false); defaultCheckbox.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { defaultIcon = defaultCheckbox.isEnabled(); } @Override public void widgetDefaultSelected(SelectionEvent e) {} }); comp.pack(); return comp; }