本文整理汇总了Java中org.eclipse.jface.fieldassist.FieldDecoration类的典型用法代码示例。如果您正苦于以下问题:Java FieldDecoration类的具体用法?Java FieldDecoration怎么用?Java FieldDecoration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FieldDecoration类属于org.eclipse.jface.fieldassist包,在下文中一共展示了FieldDecoration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createControlDecoration
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
/**
* creates a control decoration to given control. will add the control to
* decorations map
*
* @param control
* to add decoration to
* @param message
* to display when decoration is shown
* @param isRequired
* should the required asterisk be shown?
* @return created decoration
*/
public static ControlDecoration createControlDecoration(final Control control, final String message,
final boolean isRequired) {
final ControlDecoration controlDecoration = new ControlDecoration(control, SWT.RIGHT | SWT.BOTTOM);
final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
decorations.put(control, controlDecoration);
controlDecoration.setImage(fieldDecoration.getImage());
controlDecoration.hide();
control.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(final DisposeEvent e) {
final ControlDecoration remove = decorations.remove(control);
controlDecoration.dispose();
}
});
if (isRequired) {
createRequiredControlDecoration(control);
}
return controlDecoration;
}
示例3: createContents
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
@Override
protected Control createContents(Composite parent) {
Control control = super.createContents(parent);
DataBindingContext binding = new DataBindingContext();
ControlDecoration controlDecoration = new ControlDecoration(tname, SWT.LEFT | SWT.TOP);
controlDecoration.setDescriptionText(Messages.ThemesPreferencePage_duplicateName);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
FieldDecorationRegistry.DEC_ERROR);
controlDecoration.setImage(fieldDecoration.getImage());
binding.bindValue(SWTObservables.observeText(tname, SWT.Modify), PojoObservables.observeValue(this, "themename"), //$NON-NLS-1$
new UpdateValueStrategy().setAfterConvertValidator(new StringRequiredValidator(Messages.ThemesPreferencePage_enternameMessage,
controlDecoration, getButton(IDialogConstants.OK_ID))), null);
return control;
}
示例4: showErrorDecoration
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
private void showErrorDecoration( AssistField smartField, boolean show )
{
FieldDecoration dec = smartField.getErrorDecoration( );
ControlDecoration cd = smartField.controlDecoration;
if ( show )
{
cd.setImage( dec.getImage( ) );
cd.setDescriptionText( dec.getDescription( ) );
cd.setShowOnlyOnFocus( false );
cd.show( );
}
else
{
cd.hide( );
}
}
示例5: showWarningDecoration
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
private void showWarningDecoration( AssistField smartField, boolean show )
{
FieldDecoration dec = smartField.getWarningDecoration( );
ControlDecoration cd = smartField.controlDecoration;
if ( show )
{
cd.setImage( dec.getImage( ) );
cd.setDescriptionText( dec.getDescription( ) );
cd.setShowOnlyOnFocus( false );
cd.show( );
}
else
{
cd.hide( );
}
}
示例6: showContentAssistDecoration
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
private void showContentAssistDecoration( AssistField smartField,
boolean show )
{
FieldDecoration dec = getCueDecoration( );
ControlDecoration cd = smartField.controlDecoration;
if ( show )
{
cd.setImage( dec.getImage( ) );
cd.setDescriptionText( dec.getDescription( ) );
cd.setShowOnlyOnFocus( true );
cd.show( );
}
else
{
cd.hide( );
}
}
示例7: getCueDecoration
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
private FieldDecoration getCueDecoration( )
{
// We use our own decoration which is based on the JFace version.
FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault( );
FieldDecoration dec = registry.getFieldDecoration( DEC_CONTENTASSIST_ID );
if ( dec == null )
{
// Get the standard one. We use its image and our own customized
// text.
FieldDecoration standardDecoration = registry.getFieldDecoration( FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
registry.registerFieldDecoration( DEC_CONTENTASSIST_ID,
Messages.getFormattedString( "ssDecoratorContentAssist", //$NON-NLS-1$
getTriggerKeyText( ) ),
standardDecoration.getImage( ) );
dec = registry.getFieldDecoration( DEC_CONTENTASSIST_ID );
}
else
{
dec.setDescription( Messages.getFormattedString( "ssDecoratorContentAssist", //$NON-NLS-1$
getTriggerKeyText( ) ) );
}
return dec;
}
示例8: initDecorators
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
private void initDecorators() {
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
cbProjectDecoration = new ControlDecoration(cbProject, SWT.TOP | SWT.RIGHT);
cbProjectDecoration.setImage(fieldDecoration.getImage());
cbProjectDecoration.setDescriptionText("Please first create a Maven project");
cbProjectDecoration.hide();
cbVersionDecoration = new ControlDecoration(cbVersion, SWT.TOP | SWT.RIGHT);
cbVersionDecoration.setImage(fieldDecoration.getImage());
cbVersionDecoration.setDescriptionText(
"Please first add maven dependency of " + AsposeConstants.API_NAME + " for java API");
cbVersionDecoration.hide();
examplesTreeDecoration = new ControlDecoration(examplesTree, SWT.TOP | SWT.RIGHT);
examplesTreeDecoration.setImage(fieldDecoration.getImage());
examplesTreeDecoration.setDescriptionText("Please select one example category");
examplesTreeDecoration.hide();
}
示例9: decorate
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
@Override
public void decorate(Object element, IDecoration decoration){
IContact contact = (IContact) element;
if (contact.isDeleted()) {
ImageDescriptor deleted = Images.IMG_DELETE.getImageDescriptor();
decoration.addOverlay(deleted, IDecoration.TOP_LEFT);
}
if (contact.isMandator()) {
ImageDescriptor vip = Images.IMG_VIP_OVERLAY.getImageDescriptor();
decoration.addOverlay(vip, IDecoration.BOTTOM_RIGHT);
}
if (contact.isUser()) {
FieldDecoration info =
FieldDecorationRegistry.getDefault().getFieldDecoration(
FieldDecorationRegistry.DEC_INFORMATION);
ImageDescriptor infoD = ImageDescriptor.createFromImage(info.getImage());
decoration.addOverlay(infoD, IDecoration.BOTTOM_LEFT);
}
}
示例10: getFieldDecoration
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
/**
* @param type
* @param description
* @return FieldDecoration
*/
public static FieldDecoration getFieldDecoration(int type, String description) {
switch (type) {
case VALID:
FieldDecoration validDecoration = registry.getFieldDecoration(DEC_VALID);
validDecoration.setDescription(description);
return validDecoration;
case WARNING:
FieldDecoration warningDecoration = registry.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
warningDecoration.setDescription(description);
return warningDecoration;
case ERROR:
FieldDecoration errorDecoration = registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
errorDecoration.setDescription(description);
return errorDecoration;
case QUICKFIX:
FieldDecoration quickfixDecoration = registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR_QUICKFIX);
quickfixDecoration.setDescription(description);
return quickfixDecoration;
default:
return null;
}
}
示例11: 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();
}
示例12: 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();
}
示例13: 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;
}
示例14: 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;
}
示例15: showServiceKeyDecorationMessage
import org.eclipse.jface.fieldassist.FieldDecoration; //导入依赖的package包/类
private void showServiceKeyDecorationMessage(String message, boolean isError) {
FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
FieldDecoration fieldDecoration = registry.getFieldDecoration(
isError ? FieldDecorationRegistry.DEC_ERROR : FieldDecorationRegistry.DEC_INFORMATION);
serviceKeyDecoration.show();
serviceKeyDecoration.setImage(fieldDecoration.getImage());
serviceKeyDecoration.setDescriptionText(message);
serviceKeyDecoration.showHoverText(message);
}