本文整理汇总了Java中org.eclipse.swt.widgets.Widget类的典型用法代码示例。如果您正苦于以下问题:Java Widget类的具体用法?Java Widget怎么用?Java Widget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Widget类属于org.eclipse.swt.widgets包,在下文中一共展示了Widget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCheckedElements
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
@Override
public Object[] getCheckedElements() {
Object[] checked = super.getCheckedElements();
// add all items that are children of a checked node but not created yet
ArrayList<Object> result = new ArrayList<>();
for (int i = 0; i < checked.length; i++) {
Object curr = checked[i];
result.add(curr);
Widget item = findItem(curr);
if (item != null) {
Item[] children = getChildren(item);
// check if contains the dummy node
if (children.length == 1 && children[0].getData() == null) {
// not yet created
collectChildren(curr, result);
}
}
}
return result.toArray();
}
示例2: buttonSelectionListener
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
/**
* The Function will call to disable the widgets
* @param textbox1
* @param textbox2
* @param buttonWidgets
* @return Selection Adapter
*/
private SelectionAdapter buttonSelectionListener( Text textbox2,Widget... buttonWidgets){
Supplier<Stream<Widget>> streamSupplier = () -> Stream.of(buttonWidgets);
SelectionAdapter adapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
newTableRadioButton.setSelection(false);
textbox2.setEnabled(false);
streamSupplier.get().forEach((Widget widgets) ->{((Button)widgets).setEnabled(false);});
if(OSValidator.isMac()){
((Button)event.getSource()).setFocus();
}
propertyDialogButtonBar.enableApplyButton(true);
}
};
return adapter;
}
示例3: getListener
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar,
ListenerHelper helpers, final Widget... widgets) {
final Button button = ((Button)widgets[0]);
button.getShell();
if(helpers != null){
txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
file_extension=(String)helpers.get(HelperType.FILE_EXTENSION);
}
Listener listener=new Listener() {
@Override
public void handleEvent(Event event) {
if(event.type==SWT.Selection){
FilterOperationClassUtility.INSTANCE.browseFile(file_extension,((Text) widgets[0]));
propertyDialogButtonBar.enableApplyButton(true);
txtDecorator.hide();
}
}
};
return listener;
}
示例4: getListener
import org.eclipse.swt.widgets.Widget; //导入依赖的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(Constants.REGEX).matcher(string);
LOGGER.debug("Verifying text format");
if (!matchs.matches()) {
txtDecorator.setDescriptionText(Messages.CHARACTERSET);
txtDecorator.show();
event.doit = false;
} else
txtDecorator.hide();
}
};
return listener;
}
示例5: selectionListenerAction
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
@Override
public void selectionListenerAction(
PropertyDialogButtonBar propertyDialogButtonBar,
ListenerHelper helpers, Widget... widgets) {
ELTGridDetails gridDetails = (ELTGridDetails) helpers.get(HelperType.SCHEMA_GRID);
Table table =gridDetails.getTableViewer().getTable();
int temp = table.getSelectionIndex();
int[] indexs=table.getSelectionIndices();
if (temp == -1) {
WidgetUtility.errorMessage("Please Select row to delete");
} else {
table.remove(indexs);
ArrayList tempList= new ArrayList();
for (int index :indexs) {
// PropertyField test =(PropertyField) gridDetails.getGrids().get(index);
// tempList.add(test);
}
gridDetails.getGrids().removeAll(tempList);
}
}
示例6: selectionListenerAction
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
@Override
public void selectionListenerAction(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers, Widget... widgets) {
propertyDialogButtonBar.enableApplyButton(true);
table=(Table)widgets[0];
table.getParent().getShell().setFocus();
((Button) widgets[1]).setEnabled(true);
ELTGridDetails eltGridDetails = (ELTGridDetails)helpers.get(HelperType.SCHEMA_GRID);
if (eltGridDetails.getGrids().size() >= 1) {
((Button) widgets[2]).setEnabled(true);
((Button) widgets[3]).setEnabled(true);
}
GridWidgetCommonBuilder gridCommonBuilder = eltGridDetails.getGridWidgetCommonBuilder();
gridCommonBuilder.setRowSequence(rowSequence);
gridCommonBuilder.createDefaultSchema(eltGridDetails.getGrids(), eltGridDetails.getTableViewer(), eltGridDetails.getLabel());
rowSequence++;
((Component)helpers.get(HelperType.COMPONENT)).setLatestChangesInSchema(true);
}
示例7: selectionListenerAction
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
@Override
public void selectionListenerAction(final PropertyDialogButtonBar propertyDialogButtonBar, final ListenerHelper helpers, Widget... widget) {
ELTGridDetails gridDetails = (ELTGridDetails) helpers.get(HelperType.SCHEMA_GRID);
final TableViewer tableViewer = gridDetails.getTableViewer();
final int columns = tableViewer.getCellEditors().length;
final Widget[] widgets = widget;
table=(Table)widgets[0];
if (!isKeyListenerAttached){
for (int i =0; i < columns; i++){
attachShortcutKeyListener(tableViewer.getCellEditors()[i].getControl(), propertyDialogButtonBar, helpers, widgets);
}
attachShortcutKeyListener(table, propertyDialogButtonBar, helpers, widgets);
}
}
示例8: getListener
import org.eclipse.swt.widgets.Widget; //导入依赖的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;
}
示例9: getListener
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
@Override
public Listener getListener(final 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) {
if (((Combo) widgetList[0]).getText().equals("Parameter") || ((Combo) widgetList[0]).getText().equals("Others")) {
((Text) widgetList[1]).setVisible(true);
((Text) widgetList[1]).setFocus();
txtDecorator.hide();
} else {
((Text) widgetList[1]).setVisible(false);
txtDecorator.hide();
}
propertyDialogButtonBar.enableApplyButton(true);
}
};
return listener;
}
示例10: getListener
import org.eclipse.swt.widgets.Widget; //导入依赖的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(!((Button)widgetList[1]).getSelection()){
ControlDecoration fieldNameMustJava = WidgetUtility.addDecorator((Text)widgetList[0],Messages.INVALID_FILE);
if(!WidgetUtility.isFileExtention((((Text)widgetList[0]).getText()).trim(), ".java") && !(((Text)widgetList[0]).getText().trim().isEmpty())){
fieldNameMustJava.show();
((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
255, 204));
}
else
{
((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
255, 255));
fieldNameMustJava.hide();
}
}
}
};
return listener;
}
示例11: getListener
import org.eclipse.swt.widgets.Widget; //导入依赖的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(SWT.FocusIn == event.type) {
if (StringUtils.isBlank(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.Widget; //导入依赖的package包/类
@Override
public Listener getListener(
final PropertyDialogButtonBar propertyDialogButtonBar,
final ListenerHelper helpers, Widget... widgets) {
final Widget[] wigetList = widgets;
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if (event.type == SWT.CHANGED) {
propertyDialogButtonBar.enableApplyButton(true);
}
}
};
return listener;
}
示例13: getListener
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, final ListenerHelper helpers, Widget... widgets) {
final Widget[] widgetList = widgets;
if (helpers != null) {
widgetConfig = (WidgetConfig) helpers.get(HelperType.WIDGET_CONFIG);
}
Listener listener=new Listener() {
@Override
public void handleEvent(Event event) {
String comboValue = ((Combo) widgetList[0]).getText();
if (comboValue.equals(Messages.CUSTOM)) {
FilterOperationClassUtility.INSTANCE.createNewClassWizard((Text) widgetList[1], widgetConfig);
if(helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL) instanceof OperationClassDialog)
{
OperationClassDialog operationClassDialog=(OperationClassDialog)helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL);
operationClassDialog.getShell().setFocus();
}
propertyDialogButtonBar.enableApplyButton(true);
}
}
};
return listener;
}
示例14: getListener
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
Widget... widgets) {
final Widget[] widgetList = widgets;
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if (StringUtils.equalsIgnoreCase(((Combo) widgetList[0]).getText(), String.valueOf(Boolean.TRUE))) {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.ICON_INFORMATION | SWT.OK);
messageBox.setText(INFORMATION);
messageBox.setMessage("All files at given location will be overwritten.");
messageBox.open();
}
}
};
return listener;
}
示例15: getListener
import org.eclipse.swt.widgets.Widget; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
final Widget[] widgetList = widgets;
Listener listener=new Listener() {
@Override
public void handleEvent(Event event) {
String string=((Text) widgetList[0]).getText().trim();
Matcher matcher=Pattern.compile("[\\d]*").matcher(string);
if(!matcher.matches() && StringUtils.isNotBlank(string)){
((Text) widgetList[0]).setText(string.replace("@{", "").replace("}", ""));
((Text) widgetList[0]).setText("@{"+((Text) widgetList[0]).getText()+"}");
((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
}
}
};
return listener;
}