本文整理汇总了Java中org.eclipse.swt.widgets.Listener类的典型用法代码示例。如果您正苦于以下问题:Java Listener类的具体用法?Java Listener怎么用?Java Listener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Listener类属于org.eclipse.swt.widgets包,在下文中一共展示了Listener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTextBoxValue1Listener
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
/**
* Gets the text box value 1 listener.
*
* @param conditionsList
* the conditions list
* @param fieldsAndTypes
* the fields and types
* @param fieldNames
* the field names
* @param saveButton
* the save button
* @param displayButton
* the display button
* @return the text box value 1 listener
*/
public Listener getTextBoxValue1Listener(final List<Condition> conditionsList,
final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
Text text = (Text)event.widget;
int index = (int) text.getData(FilterConstants.ROW_INDEX);
Condition filterConditions = conditionsList.get(index);
filterConditions.setValue1(text.getText());
validateText(text, filterConditions.getFieldName(), fieldsAndTypes, filterConditions.getConditionalOperator());
toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
}
};
return listener;
}
示例2: configureShell
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
this.currentShell = newShell;
this.currentShell.setText(this.title);
this.currentShell.getDisplay().addFilter(SWT.Traverse, new Listener() {
@Override
public void handleEvent(Event event) {
switch (event.detail) {
case SWT.TRAVERSE_ESCAPE:
event.doit = false;
cancelPressed();
break;
default:
break;
}
}
});
}
示例3: open
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
public void open() {
final Shell shell = new Shell(getParent(), getStyle());
shell.setText("Find/replace");
createContents(shell);
shell.pack();
shell.open();
Listener researcherListener = new Listener() {
public void handleEvent(Event event) {
if (resultsIterator != null)
resultsIterator = null;
}
};
text.addListener(SWT.Modify, researcherListener);
Display display = getParent().getDisplay();
while (!shell.isDisposed())
if (!display.readAndDispatch())
display.sleep();
text.removeListener(SWT.Modify, researcherListener);
clearSearchResults();
}
示例4: renderTransparency
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
private void renderTransparency(final Shell shell) {
Group group = new Group(shell, SWT.NONE);
group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 6, 1));
group.setLayout(new GridLayout(1, false));
group.setText("Transparency");
final Scale transparencySlider = new Scale(group, SWT.HORIZONTAL);
transparencySlider.setMinimum(20);
transparencySlider.setMaximum(100);
transparencySlider.setPageIncrement(90);
transparencySlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
transparencySlider.setSelection(100);
transparencySlider.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
shell.setAlpha(255 * transparencySlider.getSelection() / 100);
}
});
}
示例5: createDialogArea
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
Link link = new Link(container, SWT.NONE);
link.setText("Your project has been successfully deployed.\n\nYou can try it with this URL:\n<a href=\""+ projectURL + "\">" + projectURL + "</a>");
link.addListener (SWT.Selection, new Listener () {
public void handleEvent(Event event) {
org.eclipse.swt.program.Program.launch(event.text);
}
});
link.setSize(330, 150);
return container;
}
示例6: GeneratorChoiceComposite
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
public GeneratorChoiceComposite(Composite parent, int style, IStructuredSelection selection, Listener listener) {
super(parent, style);
setLayout(new GridLayout(12, false));
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
setLayoutData(gridData);
this.listener = listener;
this.selection = selection;
IFile file = (IFile) selection.getFirstElement();
loadAncestor(file);
findStartElement () ;
Label explanationLabel = new Label(this, SWT.NONE);
explanationLabel.setLayoutData(new GridData(SWT.FILL));
explanationLabel.setText(MessageUtil.getString("three_modes_explanation"));
skip(this);
createAppendMode();
createExtendMode();
createNewMode();
}
示例7: buildLeftColumn
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
private void buildLeftColumn() {
final Composite composite = new Composite(this.shell, SWT.NONE);
final GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false,
true, 1, 1);
composite.setLayoutData(gd);
final FillLayout compositeLayout = new FillLayout();
compositeLayout.marginWidth = 2;
composite.setLayout(compositeLayout);
final Label label = new Label(composite, SWT.NONE);
if (this.image == null) {
this.image = new Image(display, this.getClass().getClassLoader()
.getResourceAsStream("images/document_wrench_color.png"));
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
image.dispose();
}
});
}
label.setImage(this.image);
}
示例8: buildLeftColumn
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
private void buildLeftColumn() {
final Composite composite = new Composite(this.shell, SWT.NONE);
final GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false,
true, 1, 1);
composite.setLayoutData(gd);
final FillLayout compositeLayout = new FillLayout();
compositeLayout.marginWidth = 2;
composite.setLayout(compositeLayout);
final Label label = new Label(composite, SWT.NONE);
if (this.image == null) {
this.image = new Image(display, this.getClass().getClassLoader()
.getResourceAsStream("images/light1.png"));
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
image.dispose();
}
});
}
label.setImage(this.image);
}
示例9: attachMouseScrollButtonListener
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
private void attachMouseScrollButtonListener(final ScrolledComposite scrolledComposite){
scrolledComposite.addListener(SWT.MouseWheel, new Listener() {
@Override
public void handleEvent(Event event) {
int wheelCount = event.count;
wheelCount = (int) Math.ceil(wheelCount / 3.0f);
while (wheelCount < 0) {
scrolledComposite.getVerticalBar().setIncrement(4);
wheelCount++;
}
while (wheelCount > 0) {
scrolledComposite.getVerticalBar().setIncrement(-4);
wheelCount--;
}
}
});
}
示例10: created
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public void created(final MainStatusBar.CLabelPadding label) {
final Listener click_listener = new Listener() {
@Override
public void handleEvent(Event e) {
onClick();
}
};
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
label.addListener(SWT.MouseDoubleClick, click_listener);
}
}, true);
}
示例11: getListener
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
final Widget[] widgetList = widgets;
if (helper != null){
txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
}
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
String charSet = ((Text) widgetList[0]).getText();
if(SWT.FocusIn == event.type) {
if (StringUtils.isEmpty(charSet)) {
txtDecorator.show();
((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
((Text) widgetList[0]).setToolTipText(txtDecorator.getDescriptionText());
} else {
txtDecorator.hide();
}
}
}
};
return listener;
}
示例12: getListener
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public Listener getListener(
PropertyDialogButtonBar propertyDialogButtonBar,
ListenerHelper helper, Widget... widgets) {
final Widget[] widgetList = widgets;
if (helper != null) {
txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
}
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
String charSet = ((Text) widgetList[0]).getText().trim();
if (event.type == SWT.FocusIn) {
((Text) widgetList[0]).setText(charSet.replace("@{", "").replace("}", ""));
}
}
};
return listener;
}
示例13: getListener
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
if (helper != null) {
txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
}
Listener listener=new Listener() {
@Override
public void handleEvent(Event event) {
String string=event.text;
Matcher matchs=Pattern.compile("[\\d]*").matcher(string);
if(!matchs.matches()){
txtDecorator.setDescriptionText(Messages.FIELDBATCH);
txtDecorator.show();
event.doit=false;
}else
txtDecorator.hide();
}
};
return listener;
}
示例14: IntListParameter
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
public IntListParameter(Composite composite, final String name,
int defaultValue, final String labels[], final int values[]) {
super(name);
this.name = name;
this.values = values;
if(labels.length != values.length)
return;
int value = COConfigurationManager.getIntParameter(name,defaultValue);
int index = findIndex(value,values);
list = new Combo(composite,SWT.SINGLE | SWT.READ_ONLY);
for(int i = 0 ; i < labels.length ;i++) {
list.add(labels[i]);
}
setIndex(index);
list.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
setIndex(list.getSelectionIndex());
}
});
}
示例15: getListener
import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
Widget... widgets) {
final Widget[] widgetList = widgets;
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if (StringUtils.equalsIgnoreCase(((Button) widgetList[0]).getText(), String.valueOf(FAST_LOAD)) && ((Button) widgetList[0]).getSelection() ) {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.ICON_INFORMATION | SWT.OK);
messageBox.setText(INFORMATION);
messageBox.setMessage(Messages.FAST_LOAD_ERROR_MESSAGE);
messageBox.open();
}
}
};
return listener;
}