本文整理汇总了Java中org.eclipse.jface.fieldassist.FieldDecoration.getImage方法的典型用法代码示例。如果您正苦于以下问题:Java FieldDecoration.getImage方法的具体用法?Java FieldDecoration.getImage怎么用?Java FieldDecoration.getImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.fieldassist.FieldDecoration
的用法示例。
在下文中一共展示了FieldDecoration.getImage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImage
import org.eclipse.jface.fieldassist.FieldDecoration; //导入方法依赖的package包/类
/**
* Returns an image to display in a ControlDecoration which is appropriate
* for the given status. The default implementation of this method returns
* an image according to <code>status.getSeverity()</code>:
* <ul>
* <li>IStatus.OK => No image
* <li>IStatus.INFO => FieldDecorationRegistry.DEC_INFORMATION
* <li>IStatus.WARNING => FieldDecorationRegistry.DEC_WARNING
* <li>IStatus.ERROR => FieldDecorationRegistry.DEC_ERROR
* <li>IStatus.CANCEL => FieldDecorationRegistry.DEC_ERROR
* <li>Other => No image
* </ul>
*
* @param status
* the status object.
* @return an image to display in a ControlDecoration which is appropriate
* for the given status.
*/
protected Image getImage(IStatus status)
{
if (status == null) return null;
String fieldDecorationID = null;
switch (status.getSeverity())
{
case IStatus.INFO:
fieldDecorationID = FieldDecorationRegistry.DEC_INFORMATION;
break;
case IStatus.WARNING:
fieldDecorationID = FieldDecorationRegistry.DEC_WARNING;
break;
case IStatus.ERROR:
case IStatus.CANCEL:
fieldDecorationID = FieldDecorationRegistry.DEC_ERROR;
break;
}
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(fieldDecorationID);
return fieldDecoration == null ? null : fieldDecoration.getImage();
}
示例2: getImage
import org.eclipse.jface.fieldassist.FieldDecoration; //导入方法依赖的package包/类
/**
* Returns an image to display in a ControlDecoration which is appropriate
* for the given status. The default implementation of this method returns
* an image according to <code>status.getSeverity()</code>:
* <ul>
* <li>IStatus.OK => No image
* <li>IStatus.INFO => FieldDecorationRegistry.DEC_INFORMATION
* <li>IStatus.WARNING => FieldDecorationRegistry.DEC_WARNING
* <li>IStatus.ERROR => FieldDecorationRegistry.DEC_ERROR
* <li>IStatus.CANCEL => FieldDecorationRegistry.DEC_ERROR
* <li>Other => No image
* </ul>
*
* @param status
* the status object.
* @return an image to display in a ControlDecoration which is appropriate
* for the given status.
*/
protected Image getImage(IStatus status) {
if (status == null)
return null;
String fieldDecorationID = null;
switch (status.getSeverity()) {
case IStatus.INFO:
fieldDecorationID = FieldDecorationRegistry.DEC_INFORMATION;
break;
case IStatus.WARNING:
fieldDecorationID = FieldDecorationRegistry.DEC_WARNING;
break;
case IStatus.ERROR:
case IStatus.CANCEL:
fieldDecorationID = FieldDecorationRegistry.DEC_ERROR;
break;
}
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
.getFieldDecoration(fieldDecorationID);
return fieldDecoration == null ? null : fieldDecoration.getImage();
}
示例3: getImage
import org.eclipse.jface.fieldassist.FieldDecoration; //导入方法依赖的package包/类
/**
* Returns an image to display in a ControlDecoration which is appropriate for the given status. The default
* implementation of this method returns an image according to <code>status.getSeverity()</code>:
* <ul>
* <li>IStatus.OK => No image
* <li>IStatus.INFO => FieldDecorationRegistry.DEC_INFORMATION
* <li>IStatus.WARNING => FieldDecorationRegistry.DEC_WARNING
* <li>IStatus.ERROR => FieldDecorationRegistry.DEC_ERROR
* <li>IStatus.CANCEL => FieldDecorationRegistry.DEC_ERROR
* <li>Other => No image
* </ul>
*
* @param status the status object.
* @return an image to display in a ControlDecoration which is appropriate for the given status.
*/
protected Image getImage(IStatus status) {
if (status == null)
return null;
String fieldDecorationID = null;
switch (status.getSeverity()) {
case IStatus.INFO:
fieldDecorationID = FieldDecorationRegistry.DEC_INFORMATION;
break;
case IStatus.WARNING:
fieldDecorationID = FieldDecorationRegistry.DEC_WARNING;
break;
case IStatus.ERROR:
case IStatus.CANCEL:
fieldDecorationID = FieldDecorationRegistry.DEC_ERROR;
break;
}
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
fieldDecorationID);
return fieldDecoration == null ? null : fieldDecoration.getImage();
}
示例4: addDecorator
import org.eclipse.jface.fieldassist.FieldDecoration; //导入方法依赖的package包/类
/**
* This Method use to create error message decorator,Its show an error image with message on applied controller field.
* @param control
* @param message
* @return ControlDecoration
*/
public static ControlDecoration addDecorator(Control control,String message){
ControlDecoration txtDecorator = new ControlDecoration(control,SWT.LEFT);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
Image img = fieldDecoration.getImage();
txtDecorator.setImage(img);
txtDecorator.setDescriptionText(message);
return txtDecorator;
}
示例5: addDecorator
import org.eclipse.jface.fieldassist.FieldDecoration; //导入方法依赖的package包/类
private ControlDecoration addDecorator(Control control, String message) {
ControlDecoration txtDecorator = new ControlDecoration(control, SWT.LEFT);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
FieldDecorationRegistry.DEC_ERROR);
Image img = fieldDecoration.getImage();
txtDecorator.setImage(img);
txtDecorator.setDescriptionText(message);
txtDecorator.setMarginWidth(3);
return txtDecorator;
}
示例6: createDialogArea
import org.eclipse.jface.fieldassist.FieldDecoration; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout layout = new GridLayout(3, false);
container.setLayout(layout);
Label uriLabel = new Label(container, SWT.NONE);
uriLabel.setText("Server Adress:");
GridData dataURI = new GridData();
dataURI.grabExcessHorizontalSpace = true;
dataURI.horizontalAlignment = GridData.FILL;
uriText = new Text(container, SWT.BORDER);
uriText.setLayoutData(dataURI);
uriText.setText(uri.toString());
final ControlDecoration txtDecorator = new ControlDecoration(uriText, SWT.TOP|SWT.RIGHT|SWT.FILL);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry .DEC_ERROR);
Image img = fieldDecoration.getImage();
txtDecorator.setImage(img);
txtDecorator.setDescriptionText("Pls enter only numeric fields");
// hiding it initially
txtDecorator.hide();
uriText.addModifyListener(new ModifyListener(){
@Override
public void modifyText(ModifyEvent e) {
try{
uri = uriText.getText();
txtDecorator.hide();
}catch(Exception e1){
txtDecorator.show();
}
}
});
return container;
}
示例7: buildUI
import org.eclipse.jface.fieldassist.FieldDecoration; //导入方法依赖的package包/类
/**
* @wbp.parser.entryPoint
*/
@Override
public void buildUI() {
Section generalSection = formToolkit.createSection(composite,
Section.TWISTIE | Section.TITLE_BAR);
GridData gd_generalSection = new GridData(SWT.FILL, SWT.FILL, true,
false, 1, 1);
gd_generalSection.heightHint = 240;
generalSection.setLayoutData(gd_generalSection);
formToolkit.paintBordersFor(generalSection);
generalSection.setText(Messages.BASICATTRIBUTE);
generalSection.setExpanded(true);
Composite generalComposite = new Composite(generalSection, SWT.NONE);
formToolkit.adapt(generalComposite);
formToolkit.paintBordersFor(generalComposite);
generalSection.setClient(generalComposite);
generalComposite.setLayout(new GridLayout(4, false));
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
String decorationDescription = Messages.NULLERROR;
Image decorationImage = fieldDecoration.getImage();
Label appNameLabel = formToolkit.createLabel(generalComposite, Messages.APPNAME, SWT.NONE);
appNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
appNameText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
appNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
appNameDecoration = createTextErrorDecoration(appNameText, decorationDescription, decorationImage);
Label lblNewLabel_1 = formToolkit.createLabel(generalComposite, Messages.AUTHERNAME, SWT.NONE);
lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
authorNameText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
authorNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
authorNameDecoration = createTextErrorDecoration(authorNameText, decorationDescription, decorationImage);
Label lblNewLabel_2 = formToolkit.createLabel(generalComposite,Messages.AUTHEREMAIL, SWT.NONE);
lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
authorEmailText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
authorEmailText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
authorEmailDecoration = createTextErrorDecoration(authorEmailText, decorationDescription, decorationImage);
Label lblNewLabel_3 = formToolkit.createLabel(generalComposite,Messages.AUTHORIZEDCONNECTION, SWT.NONE);
lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
authorHrefText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
authorHrefText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
authorHrefDecoration = createTextErrorDecoration(authorHrefText, decorationDescription, decorationImage);
Label lblNewLabel_4 = formToolkit.createLabel(generalComposite,Messages.STARTPAGE, SWT.NONE);
lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
ContentSrcText = formToolkit.createText(generalComposite, StringUtils.EMPTY_STRING, SWT.NONE);
ContentSrcText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
ContentSrcDecoration = createTextErrorDecoration(ContentSrcText, decorationDescription, decorationImage);
Label lblNewLabel_6 = new Label(generalComposite, SWT.NONE);
lblNewLabel_6.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
formToolkit.adapt(lblNewLabel_6, true, true);
lblNewLabel_6.setText("\u63CF\u8FF0");
descriptionText = new Text(generalComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
GridData gd_descriptionText = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_descriptionText.heightHint = 49;
descriptionText.setLayoutData(gd_descriptionText);
formToolkit.adapt(descriptionText, true, true);
}