Java Code Examples for org.eclipse.swt.widgets.Combo#addListener()
The following examples show how to use
org.eclipse.swt.widgets.Combo#addListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GalleryExampleTab.java From nebula with Eclipse Public License 2.0 | 6 votes |
private void createAnimationGroup(Composite parent) { Group animationGroup = createEmptyGroup(parent, "Animation"); animationGroup.setLayout(new RowLayout()); bAnimation = createButton(animationGroup, SWT.CHECK, "Animations", false, false); bAnimation.addListener(SWT.Selection, groupParamSelectionListener); cAnimationMovement = new Combo(animationGroup, SWT.READ_ONLY); cAnimationMovement.setItems(new String[] { "ExpoOut", "BounceOut", "ElasticOut", "LinearInOut" }); cAnimationMovement.setText("ExpoOut"); cAnimationMovement.addListener(SWT.Selection, groupParamSelectionListener); sAnimationDuration = new Spinner(animationGroup, SWT.NONE); sAnimationDuration.setMinimum(250); sAnimationDuration.setMaximum(5000); sAnimationDuration.setIncrement(100); sAnimationDuration.setSelection(500); sAnimationDuration.addListener(SWT.Selection, groupParamSelectionListener); }
Example 2
Source File: GalleryExampleTab.java From nebula with Eclipse Public License 2.0 | 6 votes |
private void createItemParametersGroup(Composite parent) { Group dataGroup = createEmptyGroup(parent, "Item parameters"); dataGroup.setLayout(new RowLayout()); cItemRenderer = new Combo(dataGroup, SWT.READ_ONLY); cItemRenderer.setItems(new String[] { "Icon", "List" }); cItemRenderer.setText("Icon"); cItemRenderer.addListener(SWT.Selection, itemRendererParamSelectionListener); bItemDropShadow = createButton(dataGroup, SWT.CHECK, "Drop shadow", false, true); sItemDropShadowSize = new Spinner(dataGroup, SWT.NONE); sItemDropShadowSize.setMinimum(0); sItemDropShadowSize.setMaximum(20); sItemDropShadowSize.setIncrement(1); sItemDropShadowSize.setSelection(5); sItemDropShadowSize.addListener(SWT.Selection, itemRendererParamSelectionListener); bItemLabel = createButton(dataGroup, SWT.CHECK, "Display labels", false, true); }
Example 3
Source File: DefaultParameterDialogControlTypeHelper.java From birt with Eclipse Public License 1.0 | 6 votes |
public void createContent( Composite parent ) { controlTypeChooser = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN ); controlTypeChooser.setVisibleItemCount( 30 ); controlTypeChooser.addListener( SWT.Selection, new Listener( ) { public void handleEvent( Event e ) { List<Listener> listeners = DefaultParameterDialogControlTypeHelper.this.listeners.get( SWT.Selection ); if ( listeners == null ) return; for ( int i = 0; i < listeners.size( ); i++ ) listeners.get( i ).handleEvent( e ); } } ); }
Example 4
Source File: FatJarPackageWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void createLaunchConfigSelectionGroup(Composite parent) { fLaunchConfigurationCombo= new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(fLaunchConfigurationCombo); fLaunchConfigurationCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fLauchConfigurationModel.addAll(Arrays.asList(getLaunchConfigurations())); String[] names= new String[fLauchConfigurationModel.size()]; for (int i= 0, size= fLauchConfigurationModel.size(); i < size; i++) { LaunchConfigurationElement element= fLauchConfigurationModel.get(i); names[i]= element.getLaunchConfigurationName(); } fLaunchConfigurationCombo.setItems(names); fLaunchConfigurationCombo.addListener(SWT.Selection, this); fLaunchConfigurationCombo.addListener(SWT.Modify, this); }
Example 5
Source File: PWCombo.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * @see org.eclipse.nebula.widgets.opal.preferencewindow.widgets.PWWidget#build(org.eclipse.swt.widgets.Composite) */ @Override public Control build(final Composite parent) { buildLabel(parent, GridData.CENTER); final Combo combo = new Combo(parent, SWT.BORDER | (editable ? SWT.NONE : SWT.READ_ONLY)); addControl(combo); for (int i = 0; i < data.size(); i++) { final Object datum = data.get(i); combo.add(datum.toString()); if (datum.equals(PreferenceWindow.getInstance().getValueFor(getPropertyKey()))) { combo.select(i); } } combo.addListener(SWT.Modify, event -> { PreferenceWindow.getInstance().setValue(getPropertyKey(), PWCombo.this.data.get(combo.getSelectionIndex())); }); return combo; }
Example 6
Source File: AbstractWizardNewTypeScriptProjectCreationPage.java From typescript.java with MIT License | 6 votes |
/** Creates the field for selecting the installed Node.js. */ private void createInstalledNodejsField(Composite parent) { if (hasEmbeddedNodeJs) { Button useInstalledNodejs = new Button(parent, SWT.RADIO); useInstalledNodejs .setText(TypeScriptUIMessages.AbstractWizardNewTypeScriptProjectCreationPage_useInstalledNodeJs_label); } String[] defaultPaths = IDENodejsProcessHelper.getAvailableNodejsPaths(); installedNodeJs = new Combo(parent, SWT.NONE); installedNodeJs.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); installedNodeJs.setItems(defaultPaths); installedNodeJs.addListener(SWT.Modify, nodeJsStatusChanged()); installedNodeJs.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { customNodeJsPath = installedNodeJs.getText(); } }); // Create Browse buttons. createBrowseButtons(parent, installedNodeJs); }
Example 7
Source File: WebBrowserViewer4Mac.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private void createNavigationBar(Composite parent) { toolBarManager = new ToolBarManager(SWT.FLAT); // toolBarManager.add(consoleAction); toolBarManager.add(backAction); toolBarManager.add(forwardAction); toolBarManager.add(stopAction); toolBarManager.add(refreshAction); ToolBar toolbar = toolBarManager.createControl(parent); toolbar.setLayoutData(GridDataFactory.fillDefaults().create()); urlCombo = new Combo(parent, SWT.DROP_DOWN); urlCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .create()); urlCombo.addListener(SWT.DefaultSelection, new Listener() { public void handleEvent(Event e) { setURL(urlCombo.getText()); } }); ToolBarManager toolBarManager2 = new ToolBarManager(SWT.FLAT); toolBarManager2.add(goAction); toolbar = toolBarManager2.createControl(parent); toolbar.setLayoutData(GridDataFactory.fillDefaults().create()); }
Example 8
Source File: WebBrowserViewer.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private void createNavigationBar(Composite parent) { toolBarManager = new ToolBarManager(SWT.FLAT); toolBarManager.add(consoleAction); toolBarManager.add(backAction); toolBarManager.add(forwardAction); toolBarManager.add(stopAction); toolBarManager.add(refreshAction); ToolBar toolbar = toolBarManager.createControl(parent); toolbar.setLayoutData(GridDataFactory.fillDefaults().create()); urlCombo = new Combo(parent, SWT.DROP_DOWN); urlCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); urlCombo.addListener(SWT.DefaultSelection, new Listener() { @Override public void handleEvent(Event e) { setURL(urlCombo.getText()); } }); ToolBarManager toolBarManager2 = new ToolBarManager(SWT.FLAT); toolBarManager2.add(goAction); toolbar = toolBarManager2.createControl(parent); toolbar.setLayoutData(GridDataFactory.fillDefaults().create()); }
Example 9
Source File: LEDSnippet.java From nebula with Eclipse Public License 2.0 | 5 votes |
private static void createTopPart() { new Label(shell, SWT.NONE); Composite top = new Composite(shell, SWT.NONE); top.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); top.setLayout(new GridLayout(2, true)); LED led = new LED(top, SWT.ICON); led.setLayoutData(new GridData(GridData.END, GridData.FILL, true, true, 1, 2)); led.setCharacter(LEDCharacter.CLEAR); Color idleColor = new Color(shell.getDisplay(), 60, 60, 60); led.setIdleColor(idleColor); SWTGraphicUtil.addDisposer(led, idleColor); Color selectedColor = new Color(shell.getDisplay(), 255, 0, 0); led.setSelectedColor(selectedColor); SWTGraphicUtil.addDisposer(led, selectedColor); Combo combo = new Combo(top, SWT.READ_ONLY); GridData gdCombo = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); gdCombo.minimumWidth = 100; combo.setLayoutData(gdCombo); for (LEDCharacter element : LEDCharacter.values()) { combo.add(element.name()); } combo.setText("CLEAR"); combo.addListener(SWT.Selection, e -> { LEDCharacter c = LEDCharacter.valueOf(combo.getText()); led.setCharacter(c); }); Button checkBox = new Button(top, SWT.CHECK); checkBox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); checkBox.setText("Dot ?"); checkBox.addListener(SWT.Selection, e -> { led.setShowDot(checkBox.getSelection()); }); new Label(shell, SWT.NONE); }
Example 10
Source File: FormatSpecifierComposite.java From birt with Eclipse Public License 1.0 | 5 votes |
private void placeComponents( ) { GridLayout glDateStandard = new GridLayout( ); glDateStandard.verticalSpacing = 5; glDateStandard.numColumns = 2; glDateStandard.marginHeight = 2; glDateStandard.marginWidth = 2; GridData gdGRPDateStandard = new GridData( GridData.FILL_BOTH ); this.setLayoutData( gdGRPDateStandard ); this.setLayout( glDateStandard ); lblDateType = new Label( this, SWT.NONE ); GridData gdLBLDateType = new GridData( ); lblDateType.setLayoutData( gdLBLDateType ); lblDateType.setText( Messages.getString( "FormatSpecifierComposite.Lbl.Type" ) ); //$NON-NLS-1$ cmbDateType = new Combo( this, SWT.DROP_DOWN | SWT.READ_ONLY ); GridData gdCMBDateType = new GridData( GridData.FILL_HORIZONTAL ); cmbDateType.setLayoutData( gdCMBDateType ); cmbDateType.addListener( SWT.Selection, this ); lblDateDetails = new Label( this, SWT.NONE ); GridData gdLBLDateDetails = new GridData( ); lblDateDetails.setLayoutData( gdLBLDateDetails ); lblDateDetails.setText( Messages.getString( "FormatSpecifierComposite.Lbl.Details" ) ); //$NON-NLS-1$ cmbDateForm = new Combo( this, SWT.DROP_DOWN | SWT.READ_ONLY ); GridData gdCMBDateForm = new GridData( GridData.FILL_HORIZONTAL ); cmbDateForm.setLayoutData( gdCMBDateForm ); cmbDateForm.addListener( SWT.Selection, this ); }
Example 11
Source File: PaginationExampleTab.java From nebula with Eclipse Public License 2.0 | 5 votes |
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.addListener(SWT.Selection, 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.addListener(SWT.Selection, e -> { String locale = localeCombo.getText(); if ("fr".equals(locale)) { pageableTable.setLocale(Locale.FRENCH); } else { pageableTable.setLocale(Locale.ENGLISH); } }); }
Example 12
Source File: PShelfExampleTab.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void createParameters(Composite parent) { GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(parent); Listener listenerRecreates = event -> { if (event.widget instanceof Button) { Button b = (Button) event.widget; if ((b.getStyle() & SWT.RADIO) != 0) { if (!b.getSelection()) return; } } recreateExample(); }; Group styles = new Group(parent, SWT.NONE); styles.setText("Styles"); GridLayoutFactory.swtDefaults().applyTo(styles); GridDataFactory.fillDefaults().applyTo(styles); border = ButtonFactory.create(styles, SWT.CHECK, "SWT.BORDER", listenerRecreates, false); simple = ButtonFactory.create(styles, SWT.CHECK, "SWT.SIMPLE", listenerRecreates, false); Group parms = new Group(parent, SWT.NONE); parms.setText("Other"); GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).applyTo(parms); new Label(parms, SWT.NONE).setText("Renderer:"); rendererCombo = new Combo(parms, SWT.READ_ONLY); rendererCombo.setItems(new String[] { "PaletteShelfRenderer", "RedmondShelfRenderer" }); rendererCombo.select(0); rendererCombo.addListener(SWT.Selection, listenerRecreates); }
Example 13
Source File: AbstractWizardNewTypeScriptProjectCreationPage.java From typescript.java with MIT License | 5 votes |
/** Creates the field for the embedded Node.js. */ private void createEmbeddedNodejsField(Composite parent, IEmbeddedNodejs[] installs) { useEmbeddedNodeJsButton = new Button(parent, SWT.RADIO); useEmbeddedNodeJsButton .setText(TypeScriptUIMessages.AbstractWizardNewTypeScriptProjectCreationPage_useEmbeddedNodeJs_label); useEmbeddedNodeJsButton.addListener(SWT.Selection, nodeJsStatusChanged()); embeddedNodeJs = new Combo(parent, SWT.READ_ONLY); embeddedNodeJs.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Create combo of embedded node.js String[] values = new String[installs.length]; String[] valueLabels = new String[installs.length]; int i = 0; for (IEmbeddedNodejs install : installs) { values[i] = install.getId(); valueLabels[i] = install.getName(); i++; } embeddedNodeJs.setItems(valueLabels); embeddedNodeJs.setFont(JFaceResources.getDialogFont()); embeddedNodeJs.addListener(SWT.Modify, nodeJsStatusChanged()); embeddedNodeJs.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { embeddedNodeJsId = embeddedNodeJs.getText(); } }); }
Example 14
Source File: GatewayTypeSelectionGridPropertySectionContribution.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @param aTabbedPropertySheetPage * @param parent */ private void createGatewaySelectionCombo(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) { combo = new Combo(parent, SWT.READ_ONLY); combo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); combo.add(GATEWAY_TYPE_AND); combo.add(GATEWAY_TYPE_XOR); combo.add(GATEWAY_TYPE_INCLUSIVE); combo.addListener(SWT.Modify, new Listener() { public void handleEvent(Event event) { if (toBeConverted()) { EClass targetEClass = getTargetEClass(); IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); if (editor instanceof ProcessDiagramEditor) { node = (GraphicalEditPart) ((IStructuredSelection) ((ProcessDiagramEditor) editor) .getDiagramGraphicalViewer().getSelection()).getFirstElement(); GraphicalEditPart newEP = GMFTools.convert(targetEClass, node, new BonitaNodesElementTypeResolver(), GMFTools.PROCESS_DIAGRAM); setEObject(newEP.resolveSemanticElement()); tabbedPropertySheetPage.selectionChanged(editor, ((IStructuredSelection) ((ProcessDiagramEditor) editor).getDiagramGraphicalViewer() .getSelection())); } } } /** * @return */ private EClass getTargetEClass() { if (combo.getText().equals(GATEWAY_TYPE_AND)) { return ProcessPackage.Literals.AND_GATEWAY; } else if (combo.getText().equals(GATEWAY_TYPE_XOR)) { return ProcessPackage.Literals.XOR_GATEWAY; } else if (combo.getText().equals(GATEWAY_TYPE_INCLUSIVE)) { return ProcessPackage.Literals.INCLUSIVE_GATEWAY; } return ProcessPackage.Literals.ACTIVITY; } /** * @return */ private boolean toBeConverted() { return !gate.eClass().equals(getTargetEClass()); } }); }
Example 15
Source File: AndroidSimOptionsTab.java From thym with Eclipse Public License 1.0 | 4 votes |
/** * @wbp.parser.entryPoint */ @Override public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); setControl(comp); comp.setLayout(new GridLayout(1, false)); Group grpProject = new Group(comp, SWT.NONE); grpProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); grpProject.setText("Project"); grpProject.setLayout(new GridLayout(3, false)); Label lblProject = new Label(grpProject, SWT.NONE); lblProject.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblProject.setText("Project:"); textProject = new Text(grpProject, SWT.BORDER); textProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textProject.addListener(SWT.Modify, dirtyListener); Button btnProjectBrowse = new Button(grpProject, SWT.NONE); btnProjectBrowse.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ElementListSelectionDialog es = new ElementListSelectionDialog(getShell(), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider()); es.setTitle("Project Selection"); es.setMessage("Select a project to run"); es.setElements(HybridCore.getHybridProjects().toArray()); if (es.open() == Window.OK) { HybridProject project = (HybridProject) es.getFirstResult(); textProject.setText(project.getProject().getName()); } } }); btnProjectBrowse.setText("Browse..."); Group grpEmulator = new Group(comp, SWT.NONE); grpEmulator.setLayout(new GridLayout(2, false)); grpEmulator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); grpEmulator.setText("Emulator"); Label lblVirtualDeviceavd = new Label(grpEmulator, SWT.NONE); lblVirtualDeviceavd.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblVirtualDeviceavd.setText("Virtual Device (AVD):"); AVDCombo = new Combo(grpEmulator, SWT.READ_ONLY); AVDCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); AVDCombo.add("", 0); AVDCombo.addListener(SWT.Selection, dirtyListener); Label lblLogFilter = new Label(grpEmulator, SWT.NONE); lblLogFilter.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblLogFilter.setText("Log Filter:"); logFilterTxt = new Text(grpEmulator, SWT.BORDER); logFilterTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); logFilterTxt.addListener(SWT.Modify, dirtyListener); try { AndroidSDKManager sdk = AndroidSDKManager.getManager(); avds = sdk.listAVDs(); for (AndroidAVD avd : avds) { AVDCombo.add(avd.getName()); } } catch (CoreException e1) { AVDCombo.removeAll();// let it fallback to default } }
Example 16
Source File: AbstractJarDestinationWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override protected void createDestinationGroup(Composite parent) { initializeDialogUnits(parent); // destination specification group Composite destinationSelectionGroup= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.numColumns= 3; destinationSelectionGroup.setLayout(layout); destinationSelectionGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); String label= getDestinationLabel(); if (label != null) { new Label(destinationSelectionGroup, SWT.NONE).setText(label); } else { layout.marginWidth= 0; layout.marginHeight= 0; } // destination name entry field fDestinationNamesCombo= new Combo(destinationSelectionGroup, SWT.SINGLE | SWT.BORDER); SWTUtil.setDefaultVisibleItemCount(fDestinationNamesCombo); fDestinationNamesCombo.addListener(SWT.Modify, this); fDestinationNamesCombo.addListener(SWT.Selection, this); GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint= SIZING_TEXT_FIELD_WIDTH; data.horizontalSpan= label == null ? 2 : 1; fDestinationNamesCombo.setLayoutData(data); if (label == null) { SWTUtil.setAccessibilityText(fDestinationNamesCombo, JarPackagerMessages.AbstractJarDestinationWizardPage_destinationCombo_AccessibilityText); } // destination browse button fDestinationBrowseButton= new Button(destinationSelectionGroup, SWT.PUSH); fDestinationBrowseButton.setText(JarPackagerMessages.JarPackageWizardPage_browseButton_text); fDestinationBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); SWTUtil.setButtonDimensionHint(fDestinationBrowseButton); fDestinationBrowseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleDestinationBrowseButtonPressed(); } }); }
Example 17
Source File: IOSSimOptionsTab.java From thym with Eclipse Public License 1.0 | 4 votes |
/** * @wbp.parser.entryPoint */ @Override public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); setControl(comp); comp.setLayout(new GridLayout(1, false)); Group grpProject = new Group(comp, SWT.NONE); grpProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); grpProject.setText("Project"); grpProject.setLayout(new GridLayout(3, false)); Label lblProject = new Label(grpProject, SWT.NONE); lblProject.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblProject.setText("Project:"); textProject = new Text(grpProject, SWT.BORDER); textProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textProject.addListener(SWT.Modify, dirtyFlagListener); Button btnProjectBrowse = new Button(grpProject, SWT.NONE); btnProjectBrowse.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ElementListSelectionDialog es = new ElementListSelectionDialog(getShell(), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider()); es.setElements(HybridCore.getHybridProjects().toArray()); es.setTitle("Project Selection"); es.setMessage("Select a project to run"); if (es.open() == Window.OK) { HybridProject project = (HybridProject) es.getFirstResult(); textProject.setText(project.getProject().getName()); } } }); btnProjectBrowse.setText("Browse..."); Group grpSimulator = new Group(comp, SWT.NONE); grpSimulator.setLayout(new GridLayout(2, false)); grpSimulator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); grpSimulator.setText("Simulator"); Label lblSdkVersion = new Label(grpSimulator, SWT.NONE); lblSdkVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblSdkVersion.setText("Device:"); comboSDKVer = new Combo(grpSimulator, SWT.READ_ONLY); comboSDKVer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboSDKVer.addListener(SWT.Selection, dirtyFlagListener); comboViewer = new ComboViewer(comboSDKVer); comboViewer.setContentProvider(new SDKContentProvider()); comboViewer.setLabelProvider( new LabelProvider() { @Override public String getText(Object element) { IOSDevice device = (IOSDevice) element; return NLS.bind("{0} ({1})", new String[]{device.getDeviceName(), device.getiOSName()}); } }); comboViewer.setInput(getSimulatorDevices()); }
Example 18
Source File: GraphicsPageableTableExample.java From nebula with Eclipse Public License 2.0 | 4 votes |
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); GridLayout layout = new GridLayout(1, false); shell.setLayout(layout); final List<String> items = createList(); // 1) Create pageable table with 10 items per page // This SWT Component create internally a SWT Table+JFace TreeViewer int pageSize = 10; final PageableTable pageableTable = new PageableTable( shell, SWT.BORDER, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, pageSize, PageResultContentProvider.getInstance(), ResultAndNavigationPageGraphicsRendererFactory.getBlueFactory(), null); pageableTable.setLayoutData(new GridData(GridData.FILL_BOTH)); // 2) Initialize the table viewer TableViewer viewer = pageableTable.getViewer(); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.setLabelProvider(new LabelProvider()); // 3) Set the page loader used to load a page (sublist of String) // according the page index selected, the page size etc. pageableTable.setPageLoader(new PageResultLoaderList<>(items)); // 4) Set current page to 0 to display the first page pageableTable.setCurrentPage(0); final Combo styleCombo = new Combo(shell, SWT.READ_ONLY); styleCombo.setItems(new String[] { "Blue", "Green", "Black" }); styleCombo.select(0); styleCombo.addListener(SWT.Selection, 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()); } }); shell.setSize(450, 300); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Example 19
Source File: GraphicsPageableTableAndTotalChangedExample.java From nebula with Eclipse Public License 2.0 | 4 votes |
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); GridLayout layout = new GridLayout(1, false); shell.setLayout(layout); Label totalLabel = new Label(shell, SWT.NONE); totalLabel.setText("Total:"); final Combo combo = new Combo(shell, SWT.READ_ONLY); combo.setItems(TOTAL_ITEMS); combo.select(3); // 1) Create pageable table with 10 items per page // This SWT Component create internally a SWT Table+JFace TreeViewer int pageSize = 10; final PageableTable pageableTable = new PageableTable( shell, SWT.BORDER, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, pageSize, PageResultContentProvider.getInstance(), ResultAndNavigationPageGraphicsRendererFactory.getBlueFactory(), null); pageableTable.setLayoutData(new GridData(GridData.FILL_BOTH)); // 2) Initialize the table viewer TableViewer viewer = pageableTable.getViewer(); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.setLabelProvider(new LabelProvider()); // 3) Set the page loader used to load a page (sublist of String) // according the page index selected, the page size etc. List<String> items = createList(combo); final PageResultLoaderList<String> pageLoader = new PageResultLoaderList<>( items); pageableTable.setPageLoader(pageLoader); // 4) Set current page to 0 to display the first page pageableTable.setCurrentPage(0); combo.addListener(SWT.Selection, e -> { List<String> _items = createList(combo); pageLoader.setItems(_items); pageableTable.refreshPage(true); }); final Combo styleCombo = new Combo(shell, SWT.READ_ONLY); styleCombo.setItems(new String[] { "Blue", "Green", "Black" }); styleCombo.select(0); styleCombo.addListener(SWT.Selection, 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()); } }); shell.setSize(450, 300); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Example 20
Source File: ModelSortPageableTableAndTotalChangedExample.java From nebula with Eclipse Public License 2.0 | 4 votes |
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); GridLayout layout = new GridLayout(2, false); shell.setLayout(layout); Label totalLabel = new Label(shell, SWT.NONE); totalLabel.setText("Total:"); final Combo combo = new Combo(shell, SWT.READ_ONLY); combo.setItems(TOTAL_ITEMS); combo.select(3); // 1) Create pageable table with 10 items per page // This SWT Component create internally a SWT Table+JFace TreeViewer int pageSize = 10; final PageableTable pageableTable = new PageableTable(shell, SWT.BORDER, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, pageSize); GridData gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 2; pageableTable.setLayoutData(gridData); // 2) Initialize the table viewer + SWT Table TableViewer viewer = pageableTable.getViewer(); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.setLabelProvider(new LabelProvider()); Table table = viewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); // 3) Create Table columns with sort of paginated list. createColumns(viewer); // 4) Set the page loader used to load a page (sublist of String) // according the page index selected, the page size etc. List<Person> items = createList(combo); final PageResultLoaderList<Person> pageLoader = new PageResultLoaderList<>( items); pageableTable.setPageLoader(pageLoader); // 5) Set current page to 0 to refresh the table pageableTable.setCurrentPage(0); combo.addListener(SWT.Selection, e -> { List<Person> _items = createList(combo); pageLoader.setItems(_items); pageableTable.refreshPage(true); }); shell.setSize(400, 250); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }