本文整理汇总了Java中org.eclipse.swt.events.SelectionListener类的典型用法代码示例。如果您正苦于以下问题:Java SelectionListener类的具体用法?Java SelectionListener怎么用?Java SelectionListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectionListener类属于org.eclipse.swt.events包,在下文中一共展示了SelectionListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addComboInTable
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
private CCombo addComboInTable(TableViewer tableViewer, TableItem tableItem, String comboName, String comboPaneName,
String editorName, int columnIndex, String[] relationalOperators, SelectionListener dropDownSelectionListener,
ModifyListener modifyListener,FocusListener focusListener) {
final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
final CCombo combo = new CCombo(buttonPane, SWT.NONE);
combo.setItems(relationalOperators);
combo.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
tableItem.setData(comboName, combo);
tableItem.setData(comboPaneName, buttonPane);
combo.addSelectionListener(dropDownSelectionListener);
combo.addModifyListener(modifyListener);
combo.addFocusListener(focusListener);
new AutoCompleteField(combo, new CComboContentAdapter(), combo.getItems());
final TableEditor editor = new TableEditor(tableViewer.getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, tableItem, columnIndex);
editor.layout();
combo.setData(editorName, editor);
return combo;
}
示例2: addButtonInTable
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
private void addButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName,
String buttonPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener,
ImagePathConstant imagePath) {
final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
final Button button = new Button(buttonPane, SWT.NONE);
//button.setText(columnName);
button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
tableItem.setData(columnName, button);
tableItem.setData(buttonPaneName, buttonPane);
button.addSelectionListener(buttonSelectionListener);
button.setImage(imagePath.getImageFromRegistry());
final TableEditor editor = new TableEditor(tableViewer.getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, tableItem, columnIndex);
editor.layout();
button.setData(editorName, editor);
}
示例3: addCheckButtonInTable
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
private void addCheckButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName,
String groupPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener) {
final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
final Button button = new Button(buttonPane, SWT.CHECK);
button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
if(null != buttonSelectionListener){
button.addSelectionListener(buttonSelectionListener);
}
tableItem.setData(columnName, button);
tableItem.setData(groupPaneName, buttonPane);
final TableEditor editor = new TableEditor(tableViewer.getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, tableItem, columnIndex);
editor.layout();
button.setData(editorName, editor);
}
示例4: getBrowseButtonSelectionListener
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
@Override
protected SelectionListener getBrowseButtonSelectionListener(final Shell shell) {
return new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
String initialPath = projectFileTabPage.getConfigFolderText();
if (initialPath.length() == 0) {
initialPath = null;
}
final ServerItemSource serverItemSource = new VersionedItemSource(buildServer.getConnection());
final ServerItemTreeDialog dialog = new ServerItemTreeDialog(
projectFileTabPage.getControl().getShell(),
Messages.getString("BuildDefinitionDialog.BrowseDialogTitle"), //$NON-NLS-1$
initialPath,
serverItemSource,
ServerItemType.ALL_FOLDERS);
if (IDialogConstants.OK_ID == dialog.open()) {
projectFileTabPage.getControl().getConfigFolderText().setText(dialog.getSelectedServerPath());
validate();
}
}
};
}
示例5: getCreateButtonSelectionListener
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
@Override
protected SelectionListener getCreateButtonSelectionListener(final Shell shell) {
return new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
final CreateBuildConfigurationWizard wizard = new CreateBuildConfigurationWizard();
// update the build definition to contain values as
// currently defined, that way
// information inside is available in the creation wizard.
updateAndVerifyBuildDefinition(true);
wizard.init(buildDefinition);
final WizardDialog dialog = new WizardDialog(getShell(), wizard);
final int rc = dialog.open();
if (rc == IDialogConstants.OK_ID) {
checkForBuildFileExistence(true);
validate();
}
}
};
}
示例6: getSelectionListener
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
private SelectionListener getSelectionListener() {
SelectionListener selectionListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (e.getSource() == selectFromRevisionButton) {
showLog(fromRevisionText);
}
else if (e.getSource() == toHeadButton || e.getSource() == toRevisionButton) {
toRevisionText.setEnabled(toRevisionButton.getSelection());
selectToRevisionButton.setEnabled(toRevisionButton.getSelection());
if (toRevisionButton.getSelection()) toRevisionText.setFocus();
}
else if (e.getSource() == selectToRevisionButton) {
showLog(toRevisionText);
}
setPageComplete(canFinish());
}
};
return selectionListener;
}
示例7: showDefaultOrCustomValueListener
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
private SelectionListener showDefaultOrCustomValueListener(final String defaultValue) {
return new SelectionAdapter() {
private String customValue = ""; //$NON-NLS-1$
@Override
public void widgetSelected(SelectionEvent event) {
boolean customLocation = !useDefaultLocation.getSelection();
// Update the targetCreator
targetCreator.setCustomLocation(customLocation);
// Enable/disable the location inputs as appropriate
locationBrowse.setEnabled(customLocation);
locationInput.setEnabled(customLocation);
// Capture the current customValue if we're disabling custom values.
if (!customLocation) {
customValue = locationInput.getText();
}
// Update the locationInput box
locationInput.setText(customLocation ? customValue : defaultValue);
}
};
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:26,代码来源:NewDataflowProjectWizardLandingPage.java
示例8: newMenuItem
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
/**
* Creates a new MenuItem.
*/
public static MenuItem newMenuItem(final Menu parent, final int style, final String text, final SelectionListener selectionListener)
{
if (Thread.currentThread() != getDisplay().getThread())
{
Resultable res = new Resultable() {public void run() {result = newMenuItem(parent, style, text, selectionListener);}};
getDisplay().syncExec(res);
return (MenuItem) res.result;
}
else
{
MenuItem menuItem = new MenuItem(parent, style);
if (text != null)
{
menuItem.setText(text);
}
if (selectionListener != null)
{
menuItem.addSelectionListener(selectionListener);
}
return menuItem;
}
}
示例9: removeMetadataListener
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
public void removeMetadataListener(Listener listener) {
if (listener == null)
return;
pageStyleCombo.removeSelectionListener((SelectionListener)listener);
if (regionTypeCombo!=null)
regionTypeCombo.removeSelectionListener((SelectionListener)listener);
structureText.removeModifyListener((ModifyListener) listener);
for (Button b : structureRadios)
b.removeSelectionListener((SelectionListener) listener);
applyStructBtn.removeSelectionListener((SelectionListener)listener);
applyStructRecBtn.removeSelectionListener((SelectionListener) listener);
linkList.removeSelectionListener((SelectionListener) listener);
deleteLinkMenuItem.removeSelectionListener((SelectionListener) listener);
linkBtn.removeSelectionListener((SelectionListener) listener);
breakLinkBtn.removeSelectionListener((SelectionListener) listener);
shapeTypeCombo.removeSelectionListener((SelectionListener) listener);
}
示例10: removeTextStyleListener
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
public void removeTextStyleListener(Listener listener) {
if (listener == null)
return;
bgColorCombo.removeSelectionListener((SelectionListener)listener);
boldCheck.removeSelectionListener((SelectionListener)listener);
fontFamilyText.removeModifyListener((ModifyListener)listener);
fontSizeSpinner.removeSelectionListener((SelectionListener)listener);
italicCheck.removeSelectionListener((SelectionListener)listener);
kerningSpinner.removeSelectionListener((SelectionListener)listener);
letterSpacedCheck.removeSelectionListener((SelectionListener)listener);
monospaceCheck.removeSelectionListener((SelectionListener)listener);
reverseVideoCheck.removeSelectionListener((SelectionListener)listener);
serifCheck.removeSelectionListener((SelectionListener)listener);
smallCapsCheck.removeSelectionListener((SelectionListener)listener);
strikethroughCheck.removeSelectionListener((SelectionListener)listener);
underlinedCheck.removeSelectionListener((SelectionListener)listener);
subscriptCheck.removeSelectionListener((SelectionListener)listener);
superscriptCheck.removeSelectionListener((SelectionListener)listener);
textColorCombo.removeSelectionListener((SelectionListener)listener);
applyBtn.removeSelectionListener((SelectionListener)listener);
applyRecursiveBtn.removeSelectionListener((SelectionListener)listener);
}
示例11: addTextStyleListener
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
public void addTextStyleListener(Listener listener) {
if (listener == null)
return;
this.listener = listener;
bgColorCombo.addSelectionListener((SelectionListener)listener);
boldCheck.addSelectionListener((SelectionListener)listener);
fontFamilyText.addModifyListener((ModifyListener)listener);
fontSizeSpinner.addSelectionListener((SelectionListener)listener);
italicCheck.addSelectionListener((SelectionListener)listener);
kerningSpinner.addSelectionListener((SelectionListener)listener);
letterSpacedCheck.addSelectionListener((SelectionListener)listener);
monospaceCheck.addSelectionListener((SelectionListener)listener);
reverseVideoCheck.addSelectionListener((SelectionListener)listener);
serifCheck.addSelectionListener((SelectionListener)listener);
smallCapsCheck.addSelectionListener((SelectionListener)listener);
strikethroughCheck.addSelectionListener((SelectionListener)listener);
underlinedCheck.addSelectionListener((SelectionListener)listener);
subscriptCheck.addSelectionListener((SelectionListener)listener);
superscriptCheck.addSelectionListener((SelectionListener)listener);
textColorCombo.addSelectionListener((SelectionListener)listener);
applyBtn.addSelectionListener((SelectionListener)listener);
applyRecursiveBtn.addSelectionListener((SelectionListener)listener);
}
示例12: widgetSelected
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
@Override
public void widgetSelected(SelectionEvent e) {
// e.doit = false;
if (e.getSource() instanceof Button) {
Button b = (Button) e.getSource();
String text = b.getText();
if (!text.isEmpty()) {
Event e1 = new Event();
e1.widget = VirtualKeyboard.this;
e1.detail = text.charAt(0);
e1.text = b.getToolTipText();
for (SelectionListener l : selListener) {
l.widgetSelected(new SelectionEvent(e1));
}
}
}
}
示例13: addSelectionListener
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
public static void addSelectionListener(Widget w, SelectionListener l) {
if (w instanceof MenuItem)
addSelectionListener((MenuItem) w, l);
else if (w instanceof ToolItem)
addSelectionListener((ToolItem) w, l);
else if (w instanceof Button)
addSelectionListener((Button) w, l);
else if (w instanceof DropDownToolItem) {
addSelectionListener((DropDownToolItem) w, l);
}
else if (w instanceof CTabFolder) {
addSelectionListener((CTabFolder) w, l);
}
else if (w instanceof Combo){
addSelectionListener((Combo) w, l);
}
else
throw new RuntimeException("Widget type not supported for selection events: " + w);
}
示例14: createButton
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
protected Button createButton(Composite parent, String label,
SelectionListener listener) {
Button button = new Button(parent, SWT.PUSH);
button.setFont(parent.getFont());
button.setText(label);
button.addSelectionListener(listener);
GridData gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = GridData.BEGINNING;
gd.widthHint = SWTUtil.getButtonWidthHint(button);
button.setLayoutData(gd);
return button;
}
示例15: addSelectionListener
import org.eclipse.swt.events.SelectionListener; //导入依赖的package包/类
/**
* Adds a {@link SelectionListener} to the {@link #spinner}. If the widget
* has not yet been created, the listener will be added when the widget is
* created.
*
* @param listener
* The listener to add.
*/
public void addSelectionListener(final SelectionListener listener) {
if (spinner != null) {
spinner.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
spinner.addSelectionListener(listener);
}
});
} else {
if (selectionListeners == null) {
selectionListeners = new ArrayList<SelectionListener>();
}
selectionListeners.add(listener);
}
return;
}