Java Code Examples for org.eclipse.swt.events.SelectionEvent
The following examples show how to use
org.eclipse.swt.events.SelectionEvent.
These examples are extracted from open source projects.
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 Project: tracecompass Author: tracecompass File: FilterViewer.java License: Eclipse Public License 2.0 | 6 votes |
FilterTraceTypeNodeComposite(Composite parent, TmfFilterTraceTypeNode node) { super(parent, node); fNode = node; fTraceTypeMap = getTraceTypeMap(fNode.getTraceTypeId()); Label label = new Label(this, SWT.NONE); label.setText(Messages.FilterViewer_TypeLabel); fTypeCombo = new CCombo(this, SWT.DROP_DOWN | SWT.READ_ONLY); fTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fTypeCombo.setItems(fTraceTypeMap.keySet().toArray(new String[0])); if (fNode.getTraceTypeId() != null) { fTypeCombo.setText(fNode.getName()); } fTypeCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TraceTypeHelper helper = checkNotNull(fTraceTypeMap.get(fTypeCombo.getText())); fNode.setTraceTypeId(helper.getTraceTypeId()); fNode.setTraceClass(helper.getTraceClass()); fNode.setName(fTypeCombo.getText()); fViewer.refresh(fNode); } }); }
Example #2
Source Project: tracecompass Author: tracecompass File: CopyExperimentDialog.java License: Eclipse Public License 2.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); createNewExperimentNameGroup(composite); fDeepCopyButton = new Button(composite, SWT.CHECK); fDeepCopyButton.setText(Messages.CopyExperimentDialog_DeepCopyButton); fDeepCopyButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { validateNewExperimentName(); } }); return composite; }
Example #3
Source Project: erflute Author: dbflute-session File: PreferenceTopPage.java License: Apache License 2.0 | 6 votes |
private void initialize(Composite parent) { final Button button = new Button(parent, SWT.NONE); button.setText(DisplayMessages.getMessage("action.title.manage.global.group")); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final ColumnGroupSet columnGroups = GlobalColumnGroupSet.load(); final ERDiagram diagram = new ERDiagram(columnGroups.getDatabase()); final ColumnGroupManageDialog dialog = new ColumnGroupManageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), columnGroups, diagram, true, -1); if (dialog.open() == IDialogConstants.OK_ID) { final List<CopyColumnGroup> newColumnGroups = dialog.getCopyColumnGroups(); columnGroups.clear(); for (final CopyColumnGroup copyColumnGroup : newColumnGroups) { columnGroups.add(copyColumnGroup.restructure(null)); } GlobalColumnGroupSet.save(columnGroups); } } }); }
Example #4
Source Project: hop Author: project-hop File: DirectoryDialogButtonListenerFactory.java License: Apache License 2.0 | 6 votes |
public static final SelectionAdapter getSelectionAdapter( final Shell shell, final Text destination ) { // Listen to the Browse... button return new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { DirectoryDialog dialog = new DirectoryDialog( shell, SWT.OPEN ); if ( destination.getText() != null ) { String fpath = destination.getText(); // String fpath = StringUtil.environmentSubstitute(destination.getText()); dialog.setFilterPath( fpath ); } if ( dialog.open() != null ) { String str = dialog.getFilterPath(); destination.setText( str ); } } }; }
Example #5
Source Project: gama Author: gama-platform File: EditboxPreferencePage.java License: GNU General Public License v3.0 | 6 votes |
@Override public void widgetSelected(final SelectionEvent e) { final int i = categoryList.getSelectionIndex(); if (i > -1) { final String name = categoryList.getItem(i); categoryList.remove(i); categoryFiles.remove(name); namesList.setItems(new String[0]); bAddFile.setEnabled(false); final TabItem ti = folder.getItem(i + 1); final Object o = ti.getData(); ti.dispose(); if (o instanceof BoxSettingsTab) { ((BoxSettingsTab) o).dispose(); } BoxProviderRegistry.getInstance().removeProvider(name); providersChanged = true; } }
Example #6
Source Project: depan Author: google File: BasicFilterEditorControl.java License: Apache License 2.0 | 6 votes |
@SuppressWarnings("unused") public BasicFilterEditorControl(FilterEditorControl<?> parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(5)); Label nameLabel = Widgets.buildCompactLabel(this, "Name: "); nameText = Widgets.buildGridBoxedText(this); updateNameText(); Label summaryLabel = Widgets.buildCompactLabel(this, "Summary: "); summaryText = Widgets.buildGridBoxedText(this); updateSummaryText(); Button inferButton = Widgets.buildTrailPushButton(this, "Infer"); inferButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { inferFilterSummary(); } }); }
Example #7
Source Project: ermasterr Author: roundrop File: ExportDBSettingDialog.java License: Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected void addListener() { super.addListener(); environmentCombo.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(final SelectionEvent e) { validate(); } }); }
Example #8
Source Project: nebula Author: eclipse File: AbstractExampleTab.java License: Eclipse Public License 2.0 | 6 votes |
private void createLinks(Composite parent) { parent.setLayout(new GridLayout()); String[] links = createLinks(); if (links == null) { return; } for (String link2 : links) { Link link = new Link(parent, SWT.NONE); link.setText(link2); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Program.launch(e.text); } }); } }
Example #9
Source Project: http4e Author: nextinterfaces File: DumbUser.java License: Apache License 2.0 | 6 votes |
/** * Creates the main window's contents * * @param parent the main window * @return Control */ protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, true)); // Create the button Button show = new Button(composite, SWT.NONE); show.setText("Show"); final Shell shell = parent.getShell(); // Display the dialog show.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create and show the dialog DumbMessageDialog dlg = new DumbMessageDialog(shell); dlg.open(); } }); parent.pack(); return composite; }
Example #10
Source Project: depan Author: google File: SubtractOptionPart.java License: Apache License 2.0 | 6 votes |
private Composite createBaseControl(Composite parent) { Composite result = Widgets.buildGridContainer(parent, 3); // Row 1) Container selection Label label = new Label(result, SWT.NULL); label.setText("&Base:"); baseText = new Text(result, SWT.BORDER | SWT.SINGLE); baseText.setLayoutData(Widgets.buildHorzFillData()); if (null != baseContainer) { baseText.setText(baseContainer.getFullPath().toString()); } Button button = new Button(result, SWT.PUSH); button.setText("Browse..."); // Install listeners after initial value assignments button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleBaseBrowse(); } }); return result; }
Example #11
Source Project: APICloud-Studio Author: apicloudcom File: FindBarDecorator.java License: GNU General Public License v3.0 | 6 votes |
private ToolItem createHistoryToolItem(ToolBar toolbar, final String preferenceName) { ToolItem historyToolItem = new ToolItem(toolbar, SWT.DROP_DOWN); historyToolItem.setImage(FindBarPlugin.getImage(FindBarPlugin.ICON_SEARCH_HISTORY)); historyToolItem.setToolTipText(Messages.FindBarDecorator_TOOLTIP_History); historyToolItem.addSelectionListener(new SelectionAdapter() { Menu menu = null; /* * (non-Javadoc) * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { ToolItem toolItem = (ToolItem) e.widget; menu = createHistoryMenu(toolItem, preferenceName, menu); } }); return historyToolItem; }
Example #12
Source Project: n4js Author: eclipse File: PreviewableWizardPage.java License: Eclipse Public License 1.0 | 6 votes |
/** * Creates the bottom controls. */ private void createBottomControls(Composite parent) { Composite bottomControls = new Composite(parent, SWT.NONE); bottomControls .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.RIGHT, SWT.CENTER).create()); bottomControls.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(0, 5, 0, 0).create()); previewToggleButton = new Button(bottomControls, SWT.PUSH); previewToggleButton.setText(HIDE_PREVIEW_TEXT); previewToggleButton.setSelection(true); previewToggleButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.BOTTOM).create()); previewToggleButton.setToolTipText(PREVIEW_BUTTON_TOOLTIP); previewToggleButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!previewVisible) { showContentPreview(); } else { hideContentPreview(); } } }); }
Example #13
Source Project: APICloud-Studio Author: apicloudcom File: WizardFolderImportPage.java License: GNU General Public License v3.0 | 6 votes |
public void widgetSelected(SelectionEvent e) { Object source = e.getSource(); if (source == fSetPrimaryMenuItem || source == fMakePrimaryButton) { ISelection selection = fTableViewer.getSelection(); if (!selection.isEmpty() && selection instanceof StructuredSelection) { Object firstElement = ((StructuredSelection) selection).getFirstElement(); // make the element checked fTableViewer.setChecked(firstElement, true); // make it as primary updatePrimaryNature(firstElement.toString()); fTableViewer.refresh(); updateButtons(); } } }
Example #14
Source Project: ermasterr Author: roundrop File: TablespaceDialog.java License: Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected void addListener() { environmentCombo.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(final SelectionEvent e) { perfomeOK(); setPropertiesData(); } }); }
Example #15
Source Project: ermasterr Author: roundrop File: EditAllAttributesDialog.java License: Apache License 2.0 | 5 votes |
private Combo createTypeCombo(final NormalColumn targetColumn) { final GridData gridData = new GridData(); gridData.widthHint = 100; final Combo typeCombo = new Combo(attributeTable, SWT.READ_ONLY); initializeTypeCombo(typeCombo); typeCombo.setLayoutData(gridData); typeCombo.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(final SelectionEvent event) { validate(); } }); final SqlType sqlType = targetColumn.getType(); final String database = diagram.getDatabase(); if (sqlType != null && sqlType.getAlias(database) != null) { typeCombo.setText(sqlType.getAlias(database)); } return typeCombo; }
Example #16
Source Project: EasyShell Author: anb0s File: ExecuteCommandPopup.java License: Eclipse Public License 2.0 | 5 votes |
@Override public void widgetDefaultSelected(SelectionEvent e) { if (e.widget != listView) { return; } executeCommandFromList(-1); }
Example #17
Source Project: depan Author: google File: RelationDisplayTableControl.java License: Apache License 2.0 | 5 votes |
private void configSorters(Table table) { int index = 0; for (TableColumn column : table.getColumns()) { final int colIndex = index++; column.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { updateSortColumn((TableColumn) event.widget, colIndex); } }); } }
Example #18
Source Project: hop Author: project-hop File: HopGuiPipelinePerfDelegate.java License: Apache License 2.0 | 5 votes |
/** * Tell the user that the pipeline is not running or that there is no monitoring configured. */ private void showEmptyGraph() { if ( perfComposite.isDisposed() ) { return; } emptyGraph = true; Label label = new Label( perfComposite, SWT.CENTER ); label.setText( BaseMessages.getString( PKG, "PipelineLog.Dialog.PerformanceMonitoringNotEnabled.Message" ) ); label.setBackground( perfComposite.getBackground() ); label.setFont( GuiResource.getInstance().getFontMedium() ); FormData fdLabel = new FormData(); fdLabel.left = new FormAttachment( 5, 0 ); fdLabel.right = new FormAttachment( 95, 0 ); fdLabel.top = new FormAttachment( 5, 0 ); label.setLayoutData( fdLabel ); Button button = new Button( perfComposite, SWT.CENTER ); button.setText( BaseMessages.getString( PKG, "PipelineLog.Dialog.PerformanceMonitoring.Button" ) ); button.setBackground( perfComposite.getBackground() ); button.setFont( GuiResource.getInstance().getFontMedium() ); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent event ) { pipelineGraph.editProperties( pipelineGraph.getPipelineMeta(), hopGui, true, PipelineDialog.Tabs.MONITOR_TAB ); } } ); FormData fdButton = new FormData(); fdButton.left = new FormAttachment( 40, 0 ); fdButton.right = new FormAttachment( 60, 0 ); fdButton.top = new FormAttachment( label, 5 ); button.setLayoutData( fdButton ); perfComposite.layout( true, true ); }
Example #19
Source Project: slr-toolkit Author: sebastiangoetz File: GeneralPageBubble.java License: Eclipse Public License 1.0 | 5 votes |
@Override public void widgetSelected(SelectionEvent e) { if(e.getSource() == bubbleScale) { lblBubbles.setText("Bubbles Scaling Factor: "+ String.format("%.2f", getScalingFactor())); } }
Example #20
Source Project: tlaplus Author: tlaplus File: ValidateableTableSectionPart.java License: MIT License | 5 votes |
public void widgetSelected(SelectionEvent e) { Object source = e.getSource(); if (source == buttonAdd) { doAdd(); } else if (source == buttonRemove) { doRemove(); } else if (source == buttonEdit) { doEdit(); } }
Example #21
Source Project: JReFrameworker Author: JReFrameworker File: ExportPayloadDropperPage.java License: MIT License | 5 votes |
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(3, false)); Label dropperJarLabel = new Label(container, SWT.NONE); dropperJarLabel.setText("Payload Dropper Jar: "); dropperJarText = new Text(container, SWT.BORDER); dropperJarText.setEditable(false); dropperJarText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); final FileDialog fileChooser = new FileDialog(container.getShell(), SWT.SAVE); fileChooser.setFilterExtensions(new String[] { "*.jar" }); fileChooser.setFileName("dropper.jar"); Button browseButton = new Button(container, SWT.NONE); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String path = fileChooser.open(); if (path != null){ jarPath = path; setPageComplete(true); } dropperJarText.setText(jarPath); } }); browseButton.setText("Browse..."); setPageComplete(false); }
Example #22
Source Project: nebula Author: eclipse File: CDateTimeObservableValue.java License: Eclipse Public License 2.0 | 5 votes |
@Override public void widgetDefaultSelected(SelectionEvent e) { if (!updating) { Date newSelection = CDateTimeObservableValue.this.dateTime.getSelection(); if (((newSelection != null) && !newSelection.equals(currentSelection)) || ((currentSelection != null) && !currentSelection.equals(newSelection))) { fireValueChange(Diffs.createValueDiff(currentSelection, newSelection)); } currentSelection = newSelection; } }
Example #23
Source Project: tuxguitar Author: phiresky File: SWTToolActionMenuItem.java License: GNU Lesser General Public License v2.1 | 5 votes |
public SWTToolActionMenuItem(ToolItem item, SWTToolBar parent) { super(item, parent); this.selectionListener = new SWTSelectionListenerManager(this); this.menu = new SWTPopupMenu(this.getParent().getControl().getShell()); this.getControl().addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { SWTToolActionMenuItem.this.onSelect(event); } }); }
Example #24
Source Project: pmTrans Author: juanerasmoe File: MenuManager.java License: GNU Lesser General Public License v3.0 | 5 votes |
private void createRecentAudiosMenu() { for (MenuItem mi : recentAudiosM.getItems()) mi.dispose(); CacheList<File> audioFilesCache = pmTrans.getRecentAudios(); for (int i = 0; i < audioFilesCache.size(); i++) addMenuItem(recentAudiosM, audioFilesCache.get(i).getName(), SWT.NONE, audioFilesCache.get(i), new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { pmTrans.openAudioFile((File) ((MenuItem) e .getSource()).getData()); } }); }
Example #25
Source Project: slr-toolkit Author: sebastiangoetz File: MultipleChoiceQuestionView.java License: Eclipse Public License 1.0 | 5 votes |
@Override protected List<Control> renderControls() { List<Control> controls = new LinkedList<>(); List<String> existingAnswers = getAnswersNullSafe(); for (String choice : question.getChoices()) { Button btn = new Button(root, SWT.CHECK); controls.add(btn); btn.setText(choice); btn.setSelection(existingAnswers.contains(choice)); btn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { List<String> answers = getAnswersNullSafe(); boolean checked = btn.getSelection(); boolean contained = answers.contains(choice); if (checked && !contained) answers.add(choice); else if (!checked && contained) answers.remove(choice); else throw new IllegalStateException(); question.addAnswer(document, answers); onQuestionChanged.accept(question); } }); } return controls; }
Example #26
Source Project: erflute Author: dbflute-session File: DirectoryText.java License: Apache License 2.0 | 5 votes |
public DirectoryText(Composite parent, int style) { this.text = new Text(parent, style); openBrowseButton = new Button(parent, SWT.NONE); openBrowseButton.setText(JFaceResources.getString("openBrowse")); openBrowseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final String filePath = Activator.showDirectoryDialog(text.getText()); text.setText(filePath); } }); }
Example #27
Source Project: AppleCommander Author: AppleCommander File: DiskImageFormatPane.java License: GNU General Public License v2.0 | 5 votes |
/** * Create a radio button for the disk image format list. */ protected void createRadioButton(Composite composite, String label, final int format, String helpText) { Button button = new Button(composite, SWT.RADIO); button.setText(label); button.setSelection(wizard.getFormat() == format); button.setToolTipText(helpText); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { getWizard().setFormat(format); } }); }
Example #28
Source Project: neoscada Author: eclipse File: TimeShiftActionController.java License: Eclipse Public License 1.0 | 5 votes |
public TimeShiftActionController ( final ControllerManager controllerManager, final ChartContext chartContext, final TimeShiftAction controller ) { super ( controllerManager.getContext (), chartContext, controller ); final DataBindingContext ctx = controllerManager.getContext (); final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace (); if ( space != null ) { this.button = new Button ( space, SWT.PUSH ); this.button.addSelectionListener ( new SelectionAdapter () { @Override public void widgetSelected ( final SelectionEvent e ) { action (); }; } ); addBinding ( ctx.bindValue ( PojoObservables.observeValue ( this, "milliseconds" ), EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DIFF ) ) ); //$NON-NLS-1$ addBinding ( ctx.bindValue ( SWTObservables.observeText ( this.button ), EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__LABEL ) ) ); addBinding ( ctx.bindValue ( SWTObservables.observeTooltipText ( this.button ), EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DESCRIPTION ) ) ); this.layoutListener = new IValueChangeListener () { @Override public void handleValueChange ( final ValueChangeEvent event ) { space.layout (); } }; this.labelProperty = EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__LABEL ); this.labelProperty.addValueChangeListener ( this.layoutListener ); space.layout (); } else { this.button = null; } }
Example #29
Source Project: gama Author: gama-platform File: EditorMenu.java License: GNU General Public License v3.0 | 5 votes |
/** * */ private void createMarkToggle(final Menu menu) { final MenuItem mark = new MenuItem(menu, SWT.CHECK); mark.setText(" Mark occurences of symbols"); mark.setImage(GamaIcons.create("toggle.mark").image()); mark.setSelection(markPref.getValue()); mark.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { markPref.set(mark.getSelection()).save(); } }); }
Example #30
Source Project: JAADAS Author: flankerhqd File: SootConfigManagerDialog.java License: GNU General Public License v3.0 | 5 votes |
protected Button createSpecialButton( Composite parent, int id, String label, boolean defaultButton, boolean enabled) { Button button = new Button(parent, SWT.PUSH); button.setText(label); button.setData(new Integer(id)); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { buttonPressed(((Integer) event.widget.getData()).intValue()); } }); if (defaultButton) { Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } } button.setFont(parent.getFont()); if (!enabled){ button.setEnabled(false); } setButtonLayoutData(button); specialButtonList.add(button); return button; }