org.eclipse.swt.events.SelectionEvent Java Examples
The following examples show how to use
org.eclipse.swt.events.SelectionEvent.
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: ExportDBSettingDialog.java From ermasterr with 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 #2
Source File: WizardFolderImportPage.java From APICloud-Studio with 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 #3
Source File: FindBarDecorator.java From APICloud-Studio with 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 #4
Source File: CopyExperimentDialog.java From tracecompass with 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 #5
Source File: PreviewableWizardPage.java From n4js with 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 #6
Source File: FilterViewer.java From tracecompass with 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 #7
Source File: SubtractOptionPart.java From depan with 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 #8
Source File: PreferenceTopPage.java From erflute with 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 #9
Source File: DumbUser.java From http4e with 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 File: DirectoryDialogButtonListenerFactory.java From hop with 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 #11
Source File: AbstractExampleTab.java From nebula with 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 #12
Source File: EditboxPreferencePage.java From gama with 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 #13
Source File: TablespaceDialog.java From ermasterr with 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 #14
Source File: BasicFilterEditorControl.java From depan with 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 #15
Source File: RelationSetTableControl.java From depan with 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 #16
Source File: RouterPropertiesEditionPartForm.java From eip-designer with Apache License 2.0 | 5 votes |
/** * */ protected Composite createToChannelsReferencesTable(FormToolkit widgetFactory, Composite parent) { this.toChannels = new ReferencesTable(getDescription(EipViewsRepository.Router.Properties.toChannels, EipMessages.RouterPropertiesEditionPart_ToChannelsLabel), new ReferencesTableListener () { public void handleAdd() { addToChannels(); } public void handleEdit(EObject element) { editToChannels(element); } public void handleMove(EObject element, int oldIndex, int newIndex) { moveToChannels(element, oldIndex, newIndex); } public void handleRemove(EObject element) { removeFromToChannels(element); } public void navigateTo(EObject element) { } }); this.toChannels.setHelpText(propertiesEditionComponent.getHelpContent(EipViewsRepository.Router.Properties.toChannels, EipViewsRepository.FORM_KIND)); this.toChannels.createControls(parent, widgetFactory); this.toChannels.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (e.item != null && e.item.getData() instanceof EObject) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(RouterPropertiesEditionPartForm.this, EipViewsRepository.Router.Properties.toChannels, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData())); } } }); GridData toChannelsData = new GridData(GridData.FILL_HORIZONTAL); toChannelsData.horizontalSpan = 3; this.toChannels.setLayoutData(toChannelsData); this.toChannels.disableMove(); toChannels.setID(EipViewsRepository.Router.Properties.toChannels); toChannels.setEEFType("eef::AdvancedReferencesTable"); //$NON-NLS-1$ // Start of user code for createToChannelsReferencesTable // End of user code return parent; }
Example #17
Source File: CreateSessionDialog.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void widgetSelected(SelectionEvent e) { if (fCombo.getItem(fCombo.getSelectionIndex()).equals(StreamingProtocol.net.name()) || fCombo.getItem(fCombo.getSelectionIndex()).equals(StreamingProtocol.net6.name())) { fPortText.setText(""); //$NON-NLS-1$ fPortText.setEnabled(false); } else { fPortText.setEnabled(true); } }
Example #18
Source File: SortTreeColumnSelectionListener.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override protected Tree getParent(SelectionEvent e) { // 1) Get tree column which fire this selection event TreeColumn treeColumn = (TreeColumn) e.getSource(); // 2) Get the owner tree return treeColumn.getParent(); }
Example #19
Source File: SdkToolsControlAddDialog.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override public void widgetSelected(SelectionEvent e) { if (rbTool.getSelection()) { dlgResult = Result.TOOL; } else if (rbSeparator.getSelection()) { dlgResult = Result.SEPARATOR; } else if (rbGroup.getSelection()) { dlgResult = Result.GROUP; } IWizardContainer cont = getContainer(); if (cont != null && cont.getCurrentPage()!=null) { cont.updateButtons(); } }
Example #20
Source File: SvnFoldersExistWarningPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void createControl(Composite parent) { Composite composite = createComposite(parent, 1); createWrappingLabel(composite, Policy.bind("SVNFoldersExistWarningPage.description"), 0 /* indent */, 1 /* columns */); //$NON-NLS-1$ table = createTable(composite, 1); table.setContentProvider(new WorkbenchContentProvider()); table.setLabelProvider(new SvnFoldersLabelProvider()); Arrays.sort(svnFolders, new Comparator() { public int compare(Object obj1, Object obj2) { IFolder folder1 = (IFolder)obj1; IFolder folder2 = (IFolder)obj2; return folder1.getFullPath().toOSString().compareTo(folder2.getFullPath().toOSString()); } }); AdaptableList input = new AdaptableList(svnFolders); table.setInput(input); continueButton = new Button(composite, SWT.CHECK); continueButton.setText(Policy.bind("SVNFoldersExistWarningPage.continue")); continueButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setPageComplete(continueButton.getSelection()); } }); setPageComplete(false); setControl(composite); }
Example #21
Source File: MenuManager.java From pmTrans with GNU Lesser General Public License v3.0 | 5 votes |
private void createRecentTextsMenu() { for (MenuItem mi : recentTextsM.getItems()) mi.dispose(); CacheList<File> textFilesCache = pmTrans.getRecentTrasncriptions(); for (int i = 0; i < textFilesCache.size(); i++) addMenuItem(recentTextsM, textFilesCache.get(i).getName(), SWT.NONE, textFilesCache.get(i), new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { pmTrans.openTranscriptionFile((File) ((MenuItem) e .getSource()).getData()); } }); }
Example #22
Source File: CDateTimeObservableValue.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void widgetSelected(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 File: RootPreferencePage.java From ermasterr with Apache License 2.0 | 5 votes |
private void initialize(final Composite parent) { final Button button = new Button(parent, SWT.NONE); button.setText(ResourceString.getResourceString("action.title.manage.global.group")); button.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(final SelectionEvent e) { final GroupSet columnGroups = GlobalGroupSet.load(); final ERDiagram diagram = new ERDiagram(columnGroups.getDatabase()); final GroupManageDialog dialog = new GroupManageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), columnGroups, diagram, true, -1); if (dialog.open() == IDialogConstants.OK_ID) { final List<CopyGroup> newColumnGroups = dialog.getCopyColumnGroups(); columnGroups.clear(); for (final CopyGroup copyColumnGroup : newColumnGroups) { columnGroups.add(copyColumnGroup.restructure(null)); } GlobalGroupSet.save(columnGroups); } } }); }
Example #24
Source File: OpenUriSelectionListenerTest.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Test public void testWidgetDefaultSelected_InvalidURI() { SelectionEvent selectionEvent = getEvent(INVALID_URI); new OpenUriSelectionListener(queryParameterProvider, errorHandler, browserSupport).widgetDefaultSelected(selectionEvent); verify(errorHandler).accept(captor.capture(), any(URI.class)); assertThat(captor.getValue(), instanceOf(URISyntaxException.class)); }
Example #25
Source File: BooleanTemplateVariable.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void createWidget(ParameterComposite parameterComposite, Composite parent) { checkbox = new Button(parent, SWT.CHECK); checkbox.setText(getLabel()); checkbox.setSelection(getValue()); checkbox.setToolTipText(getDescription()); checkbox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setValue(checkbox.getSelection()); parameterComposite.update(); } }); }
Example #26
Source File: ServiceActivatorPropertiesEditionPartImpl.java From eip-designer with Apache License 2.0 | 5 votes |
/** * */ protected Composite createToChannelsAdvancedReferencesTable(Composite parent) { String label = getDescription(EipViewsRepository.ServiceActivator.Properties.toChannels, EipMessages.ServiceActivatorPropertiesEditionPart_ToChannelsLabel); this.toChannels = new ReferencesTable(label, new ReferencesTableListener() { public void handleAdd() { addToChannels(); } public void handleEdit(EObject element) { editToChannels(element); } public void handleMove(EObject element, int oldIndex, int newIndex) { moveToChannels(element, oldIndex, newIndex); } public void handleRemove(EObject element) { removeFromToChannels(element); } public void navigateTo(EObject element) { } }); this.toChannels.setHelpText(propertiesEditionComponent.getHelpContent(EipViewsRepository.ServiceActivator.Properties.toChannels, EipViewsRepository.SWT_KIND)); this.toChannels.createControls(parent); this.toChannels.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (e.item != null && e.item.getData() instanceof EObject) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ServiceActivatorPropertiesEditionPartImpl.this, EipViewsRepository.ServiceActivator.Properties.toChannels, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData())); } } }); GridData toChannelsData = new GridData(GridData.FILL_HORIZONTAL); toChannelsData.horizontalSpan = 3; this.toChannels.setLayoutData(toChannelsData); this.toChannels.disableMove(); toChannels.setID(EipViewsRepository.ServiceActivator.Properties.toChannels); toChannels.setEEFType("eef::AdvancedReferencesTable"); //$NON-NLS-1$ return parent; }
Example #27
Source File: XFindPanel.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
protected ToolItem createPreviousItem(final ToolBar bar) { bPrev = createTool(bar, Messages.XFindPanel_FindPrevious_tooltip, ImageUtils.FIND_PREV, new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { findPrevious(); } }); bPrev.setEnabled(false); return bPrev; }
Example #28
Source File: TextEditorContextMenuContribution.java From git-appraise-eclipse with Eclipse Public License 1.0 | 5 votes |
private SelectionAdapter createFileLineCommentSelectionListener() { return new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { createComment(getFilePath(), getSelectedLineNumber()); } }; }
Example #29
Source File: ViewAttributeTabWrapper.java From erflute with Apache License 2.0 | 5 votes |
private void createFooter(Composite parent) { final Composite footer = new Composite(parent, SWT.NONE); final GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; footer.setLayout(gridLayout); createGroupCombo(footer); this.groupAddButton = new Button(footer, SWT.NONE); groupAddButton.setText(DisplayMessages.getMessage("label.button.add.group.to.view")); groupAddButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final int targetIndex = groupCombo.getSelectionIndex(); if (targetIndex == -1) { return; } final ColumnGroup columnGroup = getColumnGroups().get(targetIndex); tableComposite.addTableData(columnGroup); groupAddButton.setEnabled(false); } }); groupAddButton.setEnabled(false); createGroup(footer); initGroupCombo(); }
Example #30
Source File: ColorReferenceMenu.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected void open(final Decorations parent, final SelectionEvent trigger) { if (colorMenu == null) { colorMenu = new GamaColorMenu(mainMenu); } final ToolItem target = (ToolItem) trigger.widget; final ToolBar toolBar = target.getParent(); colorMenu.open(toolBar, trigger, colorInserter, runnable); }