本文整理汇总了Java中org.eclipse.jface.fieldassist.ControlDecoration类的典型用法代码示例。如果您正苦于以下问题:Java ControlDecoration类的具体用法?Java ControlDecoration怎么用?Java ControlDecoration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ControlDecoration类属于org.eclipse.jface.fieldassist包,在下文中一共展示了ControlDecoration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的package包/类
private void validate(Text text1, Text text2,
ControlDecoration text1Decorator, ControlDecoration text2Decorator, String lowerValue, String upperValue) {
if(validateNumericField(text1.getText())){
text1Decorator.hide();
if(StringUtils.isNotBlank(text2.getText()) && validateNumericField(text2.getText())){
if(compareBigIntegerValue(upperValue, lowerValue) == -1){
text1Decorator.show();
text1Decorator.setDescriptionText(Messages.UPPER_LOWER_BOUND_ERROR);
}else{
text1Decorator.hide();
text2Decorator.hide();
}
}
}
else{
text1Decorator.show();
text1.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
text1Decorator.setDescriptionText(Messages.DB_NUMERIC_PARAMETERZIATION_ERROR);
validateFieldWithParameter(text1.getText(), text1Decorator);
validateFieldWithParameter(text2.getText(), text2Decorator);
}
}
示例2: getListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的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;
}
示例3: getListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的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;
}
示例4: getListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的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;
}
示例5: getListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的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;
}
示例6: getListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的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;
}
示例7: getListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的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;
}
示例8: getListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的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;
}
示例9: getListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的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;
}
示例10: getListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的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(regex).matcher(string);
logger.debug(this+"::ELTVerifyTextListener is called");
if(!matchs.matches()){
txtDecorator.setDescriptionText(errorMessage);
txtDecorator.show();
event.doit=false;
logger.trace("Pattern does not matches !matchs.matches() with :" + string);
}else{
txtDecorator.hide();
logger.trace("Pattern matches with :" + string);
}
}
};
return listener;
}
示例11: validateForSingleAndDuplicateCharacter
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的package包/类
private void validateForSingleAndDuplicateCharacter(VerifyEvent e, String textBoxValue,
ControlDecoration singleCharactorDecorator, ControlDecoration duplicateDecorator, ControlDecoration emptyDecorator) {
singleCharactorDecorator.hide();
duplicateDecorator.hide();
emptyDecorator.hide();
String value = ((Text) e.widget).getText();
String currentValue = (value.substring(0, e.start) + e.text + value.substring(e.end));
if (StringUtils.isNotEmpty(currentValue)) {
validateDelimiterAndQuoteCharactorProperty(currentValue, textBoxValue, singleCharactorDecorator,
duplicateDecorator);
} else {
getButton(0).setEnabled(false);
emptyDecorator.show();
warningLabel.setText(Messages.WARNING_MESSAGE);
warningLabel.setVisible(true);
warningImageLabel.setVisible(true);
}
}
示例12: validateDelimiterAndQuoteCharactorProperty
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的package包/类
private boolean validateDelimiterAndQuoteCharactorProperty(String textBoxValue, String textBoxValue2,
ControlDecoration singleCharactorDecorator, ControlDecoration duplicateDecorator) {
if (StringUtils.length(ConvertHexValues.parseHex(textBoxValue)) == 1) {
enableAndDisableOkButtonIfAnyDecoratorIsVisible();
if (!(textBoxValue.equalsIgnoreCase(",") || textBoxValue.equalsIgnoreCase("\""))
&& !textBoxValue.equalsIgnoreCase(textBoxValue2)) {
warningLabel.setText(Messages.WARNING_MESSAGE);
warningLabel.setVisible(true);
warningImageLabel.setVisible(true);
hideDelimiterAndQuoteCharactorDecorator();
if (StringUtils.length(ConvertHexValues.parseHex(textBoxValue2)) > 1) {
getButton(0).setEnabled(false);
}
else
{
getButton(0).setEnabled(true);
enableAndDisableOkButtonIfAnyDecoratorIsVisible();
}
return false;
} else {
if (textBoxValue.equalsIgnoreCase(textBoxValue2)) {
duplicateDecorator.show();
getButton(0).setEnabled(false);
return false;
} else {
showWarningMessage(textBoxValue, textBoxValue2);
duplicateDecorator.hide();
enableAndDisableOkButtonIfAnyDecoratorIsVisible();
return true;
}
}
} else {
if (!textBoxValue.isEmpty()) {
singleCharactorDecorator.show();
getButton(0).setEnabled(false);
}
return false;
}
}
示例13: isTextBoxEmpty
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的package包/类
private void isTextBoxEmpty(ModifyEvent e, ControlDecoration emptyDecorator,ControlDecoration zeroDecorator) {
emptyDecorator.hide();
zeroDecorator.hide();
String fileSize = ((Text) e.widget).getText();
if (!fileSize.isEmpty()) {
emptyDecorator.hide();
if (Integer.parseInt(fileSize) == 0) {
zeroDecorator.show();
getButton(0).setEnabled(false);
} else {
zeroDecorator.hide();
getButton(0).setEnabled(true);
}
enableAndDisableOkButtonIfAnyDecoratorIsVisible();
} else {
getButton(0).setEnabled(false);
emptyDecorator.show();
}
}
示例14: createControl
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的package包/类
@Override
public void createControl(UI_POSITION position, Composite parent) {
// We add controls only to the BOTTOM position.
if (position == UI_POSITION.BOTTOM) {
portLabel = new Label(parent, SWT.NONE);
portLabel.setVisible(false);
portLabel.setText(Messages.getString("NEW_SERVER_DIALOG_PORT"));
portText = new Text(parent, SWT.SINGLE | SWT.BORDER);
portText.setVisible(false);
portText.setText(String.valueOf(LocalAppEngineServerBehaviour.DEFAULT_SERVER_PORT));
portText.addVerifyListener(new PortChangeMonitor());
portText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
Image errorImage = registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();
portDecoration = new ControlDecoration(portText, SWT.LEFT | SWT.TOP);
portDecoration.setDescriptionText(Messages.getString("NEW_SERVER_DIALOG_INVALID_PORT_VALUE"));
portDecoration.setImage(errorImage);
portDecoration.hide();
}
}
示例15: statusChanged
import org.eclipse.jface.fieldassist.ControlDecoration; //导入依赖的package包/类
/**
* Status changed.
*
* @param status the status
*/
private void statusChanged(IStatus status)
{
for (Iterator it = targets.iterator(); it.hasNext();)
{
IObservable observable = (IObservable) it.next();
updater.updateBackground(findControl(observable), status);
}
for (Iterator it = targetDecorations.iterator(); it.hasNext();)
{
TargetDecoration targetDecoration = (TargetDecoration) it.next();
ControlDecoration decoration = targetDecoration.decoration;
updater.update(decoration, status);
updater.updateBackground(findControl(targetDecoration.target), status);
}
}