/* Set up item for fromCombo and toCombo */ void setItemFromComboToCombo() { if (filterByCombo.getSelectionIndex() == 0) { String[] itemList = new String[Analyze.mParser.getListNodes().size() + 1]; if (Analyze.mParser.getListNodes().size() > 0) { itemList[0] = "All nodes"; for (int i = 0; i < Analyze.mParser.getListNodes().size(); i++) { NodeTrace node = Analyze.mParser.getListNodes().get(i); itemList[i + 1] = Integer.toString(node.id); } fromCombo.setItems(itemList); toCombo.setItems(itemList); } } if (filterByCombo.getSelectionIndex() == 1) { super.refreshLayoutComposite(); fromCombo.setItems(new String[] {}); toCombo.setItems(new String[] {}); ySeries = new double[Analyze.mParser.getListNodes().size()]; xSeries = new double[Analyze.mParser.getListNodes().size()]; for (int i = 0; i < Analyze.mParser.getListNodes().size(); i++) { NodeTrace node = Analyze.mParser.getListNodes().get(i); xSeries[i] = node.x; ySeries[i] = node.y; } chartAllNode = new ChartAllNode(xSeries, ySeries); chartAllNode.addObserver(this); chartAllNode.createChart(layoutComposite); } }
/** @param parent parent of this Combo */ private void createShortCutsArea(Composite parent) { InputCodeHelper keys = InputCodeHelper.getInstance(); Composite composite = new Composite(parent, SWT.NONE); compositeGridData(composite, NUM_COLUMNS); Label label = new Label(composite, SWT.NONE); label.setText(Messages.ObjectMappingPreferencePageCollectShortcut); label.setFont(LayoutUtil.BOLD_TAHOMA); GridData data2 = new GridData(); data2.horizontalSpan = 4; label.setLayoutData(data2); label = new Label(composite, SWT.NONE); m_mappingModifier = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); m_mappingModifier.setItems(keys.getModifierString()); label = new Label(composite, SWT.NONE); label.setText(" + "); // $NON-NLS-1$ m_mappingKey = InputComboUtil.createInputCombo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); label = new Label(composite, SWT.NONE); label.setText(Messages.ObjectMappingPreferencePageCollectWithParentsShortcut); label.setFont(LayoutUtil.BOLD_TAHOMA); label.setLayoutData(data2); label = new Label(composite, SWT.NONE); m_mappingWithParentsModifier = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); m_mappingWithParentsModifier.setItems(keys.getModifierString()); label = new Label(composite, SWT.NONE); label.setText(" + "); // $NON-NLS-1$ m_mappingWithParentsKey = InputComboUtil.createInputCombo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); }
/* * Implements method from IDialogPage */ @Override public void setVisible(boolean visible) { if (visible && fPattern != null) { if (fFirstTime) { fFirstTime = false; // Set item and text here to prevent page from resizing fPattern.setItems(getPreviousSearchPatterns()); fExtensions.setItems(fPreviousExtensions); // if (fExtensions.getItemCount() == 0) { // loadFilePatternDefaults(); // } if (!initializePatternControl()) { fPattern.select(0); fExtensions.setText("*"); // $NON-NLS-1$ handleWidgetSelected(); } } fPattern.setFocus(); } updateOKStatus(); IEditorInput editorInput = getContainer().getActiveEditorInput(); getContainer() .setActiveEditorCanProvideScopeSelection( editorInput != null && editorInput.getAdapter(IFile.class) != null); super.setVisible(visible); }
/** * 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 refresh(final boolean repopulateCombo) { if (combo == null || combo.isDisposed()) { return; } // $TODO GTK workaround try { if (diagram == null || domain == null) { combo.setEnabled(false); combo.setText(StringUtil.EMPTY_STRING); } else { if (repopulateCombo) { combo.setItems(getPickableConcerns()); } String currentConcern = StringUtil.EMPTY_STRING; if (getDiagram().getCurrentConcern() != null) { currentConcern = getDiagram().getCurrentConcern().getName(); } final int index = combo.indexOf(currentConcern); if (index == -1 || forceSetText) { combo.setText(currentConcern); } else { combo.select(index); } combo.setEnabled(true); } } catch (final SWTException exception) { if (!"gtk".equals(SWT.getPlatform())) { // $NON-NLS-1$ throw exception; } } }
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 createToolCombo(Composite top) { Composite comboTop = new Composite(top, SWT.NONE); comboTop.setLayout(new GridLayout(2, false)); Label toolLabel = new Label(comboTop, SWT.NONE); toolLabel.setText(Messages.getString("ValgrindOptionsTab.Tool_to_run")); // $NON-NLS-1$ toolsCombo = new Combo(comboTop, SWT.READ_ONLY); tools = getPlugin().getRegisteredToolIDs(); String[] names = new String[tools.length]; for (int i = 0; i < names.length; i++) { names[i] = capitalize(getPlugin().getToolName(tools[i])); } toolsCombo.setItems(names); toolsCombo.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { // user selected change, set defaults in new tool if (!isInitializing) { initDefaults = true; int ix = toolsCombo.getSelectionIndex(); tool = tools[ix]; handleToolChanged(); updateLaunchConfigurationDialog(); } } }); }
protected void updateStubs() { ILiferayRuntimeStub[] stubs = LiferayServerCore.getRuntimeStubs(); if (CoreUtil.isNullOrEmpty(stubs)) { return; } String[] names = new String[stubs.length]; LiferayRuntimeStubDelegate delegate = getStubDelegate(); String stubId = delegate.getRuntimeStubTypeId(); int stubIndex = -1; for (int i = 0; i < stubs.length; i++) { names[i] = stubs[i].getName(); if (stubs[i].getRuntimeStubTypeId().equals(stubId)) { stubIndex = i; } } comboRuntimeStubType.setItems(names); if (stubIndex >= 0) { comboRuntimeStubType.select(stubIndex); } }
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); Combo combo = new Combo(shell, SWT.NONE); combo.setItems(new String[] {"A-1", "B-1", "C-1"}); Text text = new Text(shell, SWT.SINGLE | SWT.BORDER); text.setText("some text"); combo.addListener( SWT.DefaultSelection, new Listener() { public void handleEvent(Event e) { System.out.println(e.widget + " - Default Selection"); } }); text.addListener( SWT.DefaultSelection, new Listener() { public void handleEvent(Event e) { System.out.println(e.widget + " - Default Selection"); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
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(); }
/* * (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); }
private void updateInput() { final String selectedAddress = fHostAddressControl.getText(); final List<String> list = new ArrayList<>(fHistoryAddress.size() + fAdditionalAddress.size()); list.addAll(fHistoryAddress); for (final String address : fAdditionalAddress) { if (!list.contains(address)) { list.add(address); } } fHostAddressControl.setItems(list.toArray(new String[list.size()])); fRServerViewer.setInput(fRServerList); if (fUsername != null && fUsername.length() > 0) { Display.getCurrent() .asyncExec( new Runnable() { @Override public void run() { if (fInitialAddress != null) { fHostAddressControl.setText(fInitialAddress); fInitialAddress = null; } else if (selectedAddress != null && selectedAddress.length() > 0) { fHostAddressControl.setText(selectedAddress); } else if (fHostAddressControl.getItemCount() > 0) { fHostAddressControl.select(0); } fRServerViewer.expandToLevel(fUsername.toLowerCase(), 1); updateState(); } }); } }
@Override protected Control createDialogArea(Composite shell) { setTitle(TITLE); setMessage(DEFAULT_MESSAGE); Composite parent = (Composite) super.createDialogArea(shell); Composite c = new Composite(parent, SWT.BORDER); c.setLayout(new GridLayout(2, false)); c.setLayoutData(new GridData(GridData.FILL_BOTH)); createLabel(c, "Filter Name:"); mFilterNameText = new Text(c, SWT.BORDER); mFilterNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mFilterNameText.setText(mFilterName); createSeparator(c); createLabel(c, "by Log Tag:"); mTagFilterText = new Text(c, SWT.BORDER); mTagFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mTagFilterText.setText(mTag); createLabel(c, "by Log Message:"); mTextFilterText = new Text(c, SWT.BORDER); mTextFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mTextFilterText.setText(mText); createLabel(c, "by PID:"); mPidFilterText = new Text(c, SWT.BORDER); mPidFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mPidFilterText.setText(mPid); createLabel(c, "by Application Name:"); mAppNameFilterText = new Text(c, SWT.BORDER); mAppNameFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mAppNameFilterText.setText(mAppName); createLabel(c, "by Log Level:"); mLogLevelCombo = new Combo(c, SWT.READ_ONLY | SWT.DROP_DOWN); mLogLevelCombo.setItems(getLogLevels().toArray(new String[0])); mLogLevelCombo.select(getLogLevels().indexOf(mLogLevel)); /* call validateDialog() whenever user modifies any text field */ ModifyListener m = new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { DialogStatus status = validateDialog(); mOkButton.setEnabled(status.valid); setErrorMessage(status.message); } }; mFilterNameText.addModifyListener(m); mTagFilterText.addModifyListener(m); mTextFilterText.addModifyListener(m); mPidFilterText.addModifyListener(m); mAppNameFilterText.addModifyListener(m); return c; }
/** * 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; }
/** Load list of scopes for user selection of top level element for report. */ private void setupComboScopes() { // check if audit was selected by context menu: if (this.auditId != null && isContextMenuCall()) { scopeCombo.removeAll(); scopeCombo.add(this.auditName); rootElement = auditId; scopeCombo.setEnabled(true); scopeCombo.select(0); scopeCombo.redraw(); return; } else if (this.preSelectedElments != null && this.preSelectedElments.size() > 0 && isContextMenuCall()) { scopeCombo.removeAll(); ArrayList<Integer> auditIDList = new ArrayList<Integer>(); StringBuilder sb = new StringBuilder(); for (CnATreeElement elmt : preSelectedElments) { sb.append(elmt.getTitle()); if (preSelectedElments.indexOf(elmt) != preSelectedElments.size() - 1) sb.append(" & "); auditIDList.add(elmt.getDbId()); } scopeCombo.add(sb.toString()); rootElements = auditIDList.toArray(new Integer[auditIDList.size()]); scopeCombo.setEnabled(false); scopeCombo.select(0); scopeCombo.redraw(); return; } scopes = new ArrayList<CnATreeElement>(); scopeTitles = new ArrayList<String>(); scopes.addAll(loadScopes()); scopes.addAll(loadITVerbuende()); Collections.sort( scopes, new Comparator<CnATreeElement>() { @Override public int compare(CnATreeElement o1, CnATreeElement o2) { return o1.getTitle().compareToIgnoreCase(o2.getTitle()); } }); for (CnATreeElement elmt : scopes) { scopeTitles.add(elmt.getTitle()); if (LOG.isDebugEnabled()) { LOG.debug( Messages.GenerateReportDialog_16 + elmt.getDbId() + ": " + elmt .getTitle()); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$ // //$NON-NLS-1$ } } String[] titles = scopeTitles.toArray(new String[scopeTitles.size()]); scopeCombo.setItems(titles); }
@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); }
/** 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 refresh() { IRooInstall defaultInstall = RooCoreActivator.getDefault().getInstallManager().getDefaultRooInstall(); if (defaultInstall != null) { useDefault.setText( NewRooWizardMessages.bind( NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallation, defaultInstall.getName())); } else { setErrorMessage( NewRooWizardMessages.NewRooProjectWizardPageOne_noRooInstallationConfigured); setPageComplete(false); useDefault.setText( NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallationNoCurrent); } rooInstallCombo.setItems( RooCoreActivator.getDefault().getInstallManager().getAllInstallNames()); String[] names = rooInstallCombo.getItems(); for (int i = 0; i < names.length; i++) { if (RooCoreActivator.getDefault().getInstallManager().getRooInstall(names[i]).isDefault()) { rooInstallCombo.select(i); break; } } fireEvent(); }
public void refresh() { IGrailsInstall defaultInstall = GrailsCoreActivator.getDefault().getInstallManager().getDefaultGrailsInstall(); if (defaultInstall != null) { useDefault.setText( org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallation + defaultInstall.getName() + "')"); } else { setErrorMessage( org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages .NewGrailsProjectWizardPageOne_noGrailsInstallation); setPageComplete(false); useDefault.setText( org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallationNoCurrent); } grailsInstallCombo.setItems( GrailsCoreActivator.getDefault().getInstallManager().getAllInstallNames()); String[] names = grailsInstallCombo.getItems(); for (int i = 0; i < names.length; i++) { if (GrailsCoreActivator.getDefault() .getInstallManager() .getGrailsInstall(names[i]) .isDefault()) { grailsInstallCombo.select(i); break; } } setChanged(); notifyObservers(); }
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; }
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(); } }); }
@Override protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults() .grab(true, false) .indent(0, 10) .align(SWT.FILL, SWT.BEGINNING) .applyTo(composite); GridLayoutFactory.fillDefaults().spacing(0, 8).margins(0, 10).applyTo(composite); Group group = new Group(composite, SWT.NONE); group.setText("Debugging"); GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.BEGINNING).applyTo(group); GridLayoutFactory.fillDefaults().numColumns(2).margins(8, 8).applyTo(group); Label label = new Label(group, SWT.NONE); label.setText("Break on exceptions:"); label.pack(); // int labelWidth = label.getSize().x; exceptionsCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY); exceptionsCombo.setItems( new String[] { BreakOnExceptions.none.toString(), BreakOnExceptions.uncaught.toString(), BreakOnExceptions.all.toString() }); exceptionsCombo.select( exceptionsCombo.indexOf(SDBGDebugCorePlugin.getPlugin().getBreakOnExceptions().toString())); invokeToStringButton = new Button(group, SWT.CHECK); invokeToStringButton.setText("Invoke toString() methods when debugging"); GridDataFactory.swtDefaults().span(2, 1).applyTo(invokeToStringButton); useSmartStepOverButton = new Button(group, SWT.CHECK); useSmartStepOverButton.setText("Execute the whole source language line when stepping-over"); GridDataFactory.swtDefaults().span(2, 1).applyTo(useSmartStepOverButton); useSmartStepInOutButton = new Button(group, SWT.CHECK); useSmartStepInOutButton.setText( "Skip non-sourcemapped JavaScript frames when stepping-in and out"); GridDataFactory.swtDefaults().span(2, 1).applyTo(useSmartStepInOutButton); Label excludeFromLogicalStructureLabel = new Label(group, SWT.NONE); excludeFromLogicalStructureLabel.setText("Objects to exclude from Logical Structure (regexp):"); GridDataFactory.swtDefaults().span(2, 1).applyTo(excludeFromLogicalStructureLabel); excludeFromLogicalStructureText = new Text(group, SWT.BORDER); GridDataFactory.swtDefaults() .span(2, 1) .align(SWT.FILL, SWT.CENTER) .applyTo(excludeFromLogicalStructureText); // createBrowserConfig(composite, labelWidth); initFromPrefs(); return composite; }
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; }
public static void updateCombo(Combo combo, String[] items) { combo.setEnabled(items.length > 1); String oldItem = combo.getText(); combo.setItems(items); combo.select(0); selectByItem(combo, oldItem); }
private void initialSettings() { btnBrisi_.setEnabled(false); btnNovo_.setEnabled(false); comboKontrola_.setItems(dB.getControlItemsFromDB("as_control", "")); textPrimjena_.setText(""); comboKontrola_.setText(""); }
@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); }