本文整理汇总了Java中org.eclipse.swt.events.SelectionAdapter类的典型用法代码示例。如果您正苦于以下问题:Java SelectionAdapter类的具体用法?Java SelectionAdapter怎么用?Java SelectionAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SelectionAdapter类属于org.eclipse.swt.events包,在下文中一共展示了SelectionAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBottomControls
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
/**
* 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();
}
}
});
}
示例2: createFilterControls
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
protected void createFilterControls(Composite con) {
Label filterLabel = new Label(con,SWT.NONE);
filterLabel.setText("Filter:");
GridDataFactory.swtDefaults().applyTo(filterLabel);
Text filterText = new Text(con, SWT.BORDER);
filterText.setMessage("(" + PreferenceFilter.MIN_FILTER_CHARS + " chars at least)");
filterText.addModifyListener(event -> {
filterChanged(filterText.getText());
});
GridDataFactory.fillDefaults().grab(true,false).applyTo(filterText);
Button clearBtn = new Button(con, SWT.PUSH);
clearBtn.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(PrefEditorPlugin.PLUGIN_ID,"icons/clear.gif").createImage());
GridDataFactory.swtDefaults().applyTo(clearBtn);
clearBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
filterText.setText("");
filterChanged("");
}
});
}
示例3: setupButtonGroup
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
private void
setupButtonGroup(
final List<Button> buttons )
{
for ( final Button b: buttons ){
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if ( !b.getSelection()){
b.setSelection( true );
}
for ( Button b2: buttons ){
if ( b2 != b ){
b2.setSelection( false );
}
}
}});
}
Utils.makeButtonsEqualWidth( buttons );
}
示例4: attachButtonListner
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
private void attachButtonListner(Button selectKeysButton) {
selectKeysButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String buttonText = Messages.UPDATE_KEYS_WINDOW_LABEL;
FieldDialog fieldDialog = new FieldDialog(new Shell(), propertyDialogButtonBar);
fieldDialog.setComponentName(buttonText);
fieldDialog.setSourceFieldsFromPropagatedSchema(getPropagatedSchema());
if(StringUtils.isNotBlank(updateByKeysTextBox.getText())){
fieldDialog.setPropertyFromCommaSepratedString(updateByKeysTextBox.getText());
}
fieldDialog.open();
String valueForNewTableTextBox = fieldDialog.getResultAsCommaSeprated();
if(valueForNewTableTextBox !=null){
updateByKeysTextBox.setText(valueForNewTableTextBox);
}
showHideErrorSymbol(widgets);
}
});
}
示例5: createContents
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
@Override
protected Control createContents ( final Composite parent )
{
final Composite wrapper = new Composite ( parent, SWT.NONE );
wrapper.setLayout ( new GridLayout ( 1, false ) );
final Label label = new Label ( wrapper, SWT.NONE );
label.setText ( "Preferences for Eclipse SCADA Security" );
final Button testButton = new Button ( wrapper, SWT.NONE );
testButton.setText ( "Test key selection…" );
testButton.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent e )
{
openDialog ();
}
} );
return wrapper;
}
示例6: ResetControllerImpl
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
public ResetControllerImpl ( final ControllerManager controllerManager, final ChartContext chartContext, final ResetController controller )
{
final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace ();
this.resetHandler = chartContext.getResetHandler ();
if ( space != null && this.resetHandler != null )
{
this.button = new Button ( space, SWT.PUSH );
this.button.setText ( Messages.ResetControllerImpl_Label );
this.button.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent e )
{
action ();
}
} );
space.layout ();
}
else
{
this.button = null;
}
}
示例7: createDownButtonListener
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
private void createDownButtonListener() {
if (downButton != null && selectedElementsTableViewer != null) {
downButton.addSelectionListener(new SelectionAdapter() {
// event is null when featureTableViewer is double clicked
@Override
public void widgetSelected(final SelectionEvent event) {
final IStructuredSelection selection = (IStructuredSelection) selectedElementsTableViewer.getSelection();
final Iterator<EObject> i = Iterators.filter(selection.iterator(), EObject.class);
int maxIndex = selectedElements.size() - selection.size();
while (i.hasNext()) {
final EObject value = i.next();
final int index = selectedElements.indexOf(value);
selectedElements.move(Math.min(index + 1, maxIndex++), value);
}
selectedElementsTableViewer.refresh();
}
});
}
}
示例8: TrendControlImage
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
public TrendControlImage ( final Composite parent, final int style, final String connectionId, final String itemId, final String queryString )
{
super ( parent, style );
this.connectionId = connectionId;
this.itemId = itemId;
this.queryString = queryString;
setLayout ( new FillLayout () );
final Button button = new Button ( parent, SWT.PUSH | SWT.FLAT );
button.setImage ( org.eclipse.scada.vi.details.swt.Activator.getDefault ().getImageRegistry ().get ( org.eclipse.scada.vi.details.swt.Activator.IMG_TREND ) );
button.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent e )
{
startHdView ();
}
} );
}
示例9: LinkComposite
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
public LinkComposite ( final Composite parent, final int style, final String format )
{
super ( parent, style );
final RowLayout layout = new RowLayout ();
layout.wrap = false;
layout.center = true;
layout.spacing = 7;
layout.pack = true;
setLayout ( layout );
this.textLabel = new Link ( this, SWT.NONE );
this.textLabel.setText ( format );
this.textLabel.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent event )
{
logger.info ( "LinkComponent selected: {}", event.text ); //$NON-NLS-1$
Program.launch ( event.text );
}
} );
}
示例10: createAdvancedContent
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
private Composite createAdvancedContent ( final Composite advWrapper )
{
final Composite advContent = new Composite ( advWrapper, SWT.NONE );
advContent.setLayout ( new GridLayout ( 1, false ) );
final Button credentialsAsProperties = new Button ( advContent, SWT.CHECK );
credentialsAsProperties.setText ( Messages.LoginDialog_CredentialsButtons_Text );
credentialsAsProperties.setToolTipText ( Messages.LoginDialog_CredentialsButtons_ToolTip );
credentialsAsProperties.setSelection ( this.flagCredentialsAsProperties );
credentialsAsProperties.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent e )
{
LoginDialog.this.flagCredentialsAsProperties = credentialsAsProperties.getSelection ();
}
} );
return advContent;
}
示例11: updateAndPrimaryWidgetSelection
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
/**
* The Function will cal on update and primary key button selection listener
* @param butoon
* @param textBox
* @return Selection Adapter
*/
private SelectionAdapter updateAndPrimaryWidgetSelection(Button butoon, Text textBox){
SelectionAdapter adapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String buttonText;
//TODO as above
/*if(StringUtils.equalsIgnoreCase(butoon.getText(), Messages.UPDATE_BY_KEYS)){
buttonText = Messages.UPDATE_KEYS_WINDOW_LABEL;
}else{*/
buttonText = Messages.PRIMARY_KEYS_WINDOW_LABEL;
FieldDialog fieldDialog = new FieldDialog(new Shell(), propertyDialogButtonBar);
fieldDialog.setComponentName(buttonText);
fieldDialog.setSourceFieldsFromPropagatedSchema(schemaFields);
if(StringUtils.isNotBlank(textBox.getText())){
fieldDialog.setPropertyFromCommaSepratedString(textBox.getText());
}
fieldDialog.open();
String valueForNewTableTextBox = fieldDialog.getResultAsCommaSeprated();
if(valueForNewTableTextBox !=null){
textBox.setText(valueForNewTableTextBox);
}
}
};
return adapter;
}
示例12: LabelizedCheckBoxes
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
/**
* Create the composite.
* @param parent
* @param style
*/
public LabelizedCheckBoxes(Composite parent,
int style,
String [] labels,
boolean [] enabled,
boolean [] checked,
SelectionAdapter [] checkBoxSelectionAdapters) {
super(parent, style);
setLayout(new GridLayout(10, false));
buttons = new Button [labels.length];
for (int i = 0; i < labels.length; i++) {
buttons [i] = new Button(parent, SWT.CHECK);
buttons [i].setEnabled(enabled [i]);
buttons [i].setSelection(checked [i]);
buttons [i].setText(labels [i]);
if (checkBoxSelectionAdapters[i]!=null) {
buttons [i].addSelectionListener(checkBoxSelectionAdapters[i]);
}
buttons [i].setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 6, 1));
buttons [i].setData(PROJECT_PROPERTY_PAGE_WIDGET_ID, BUTTON+"."+i);
}
}
示例13: createRemoveBlockedElementGroup
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
private void createRemoveBlockedElementGroup (Composite parent) {
Label lfiller = new Label(parent, SWT.NONE);
lfiller.setText("");
Label lblRemoveBlockedElement = new Label(parent, SWT.NONE);
lblRemoveBlockedElement.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblRemoveBlockedElement.setText(MessageUtil.getString("removeBlockedElement"));
removeBockedElementButton = new Button(parent, SWT.CHECK);
removeBockedElementButton.setText("");
removeBockedElementButton.setSelection(true);
removeBockedElementButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
validatePage();
}
});
}
示例14: createDisplayReportElementGroup
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
private void createDisplayReportElementGroup (Composite parent) {
Label lfiller = new Label(parent, SWT.NONE);
lfiller.setText("");
Label lblDisplayReporElement = new Label(parent, SWT.NONE);
lblDisplayReporElement.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblDisplayReporElement.setText(MessageUtil.getString("displayReport"));
displayDetailsButton = new Button(parent, SWT.CHECK);
displayDetailsButton.setText("");
displayDetailsButton.setSelection(true);
new Label(parent, SWT.NONE);
displayDetailsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
validatePage();
}
});
}
示例15: createButtonsForButtonBar
import org.eclipse.swt.events.SelectionAdapter; //导入依赖的package包/类
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
Button btnReset = createButton(parent, IDialogConstants.NO_ID, Messages.FilterDialog_reset, false);
createButton(parent, IDialogConstants.CANCEL_ID, Messages.FilterDialog_cancel, false);
btnReset.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
text.setText(""); //$NON-NLS-1$
btnRegEx.setSelection(false);
objViewer.setAllChecked(false);
chgViewer.setAllChecked(false);
}
});
}