本文整理汇总了Java中org.eclipse.jface.fieldassist.FieldDecorationRegistry类的典型用法代码示例。如果您正苦于以下问题:Java FieldDecorationRegistry类的具体用法?Java FieldDecorationRegistry怎么用?Java FieldDecorationRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FieldDecorationRegistry类属于org.eclipse.jface.fieldassist包,在下文中一共展示了FieldDecorationRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createControl
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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();
}
}
示例2: getImage
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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: createControlDecoration
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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;
}
示例4: createContents
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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;
}
示例5: setDecoratorNullable
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的package包/类
protected void setDecoratorNullable(IParameter prm) {
if (nullDecoration == null)
return;
if (params.containsKey(prm.getName())) {
if (params.get(prm.getName()) == null) {
nullDecoration.setDescriptionText(Messages.ADataInput_settonull_explain);
nullDecoration.setImage(FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
} else {
nullDecoration.hide();
return;
}
} else {
nullDecoration.setDescriptionText(Messages.ADataInput_removeparam_explain);
nullDecoration.setImage(FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
}
nullDecoration.show();
return;
}
示例6: determineImage
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的package包/类
private Image determineImage(int severity) {
String id = "";
switch (severity) {
case IStatus.INFO:
id = FieldDecorationRegistry.DEC_INFORMATION;
break;
case IStatus.WARNING:
id = FieldDecorationRegistry.DEC_WARNING;
break;
case IStatus.ERROR:
id = FieldDecorationRegistry.DEC_ERROR;
break;
default:
Logger logger = Logger.getLogger(EMFDetailFormPart.class);
logger.warn("unexpected status for validation failure: " + severity);
id = FieldDecorationRegistry.DEC_ERROR;
}
return FieldDecorationRegistry.getDefault().getFieldDecoration(id).getImage();
}
示例7: createClassNameInput
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的package包/类
private void createClassNameInput(Composite result) {
Label label= new Label(result, SWT.LEAD);
label.setText(RefactoringMessages.ExtractClassWizard_label_class_name);
final Text text= new Text(result, SWT.SINGLE | SWT.BORDER);
fClassNameDecoration= new ControlDecoration(text, SWT.TOP | SWT.LEAD);
text.setText(fDescriptor.getClassName());
text.selectAll();
text.setFocus();
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
fDescriptor.setClassName(text.getText());
validateRefactoring();
}
});
GridData gridData= new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalIndent= FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
text.setLayoutData(gridData);
}
示例8: updateDecoration
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的package包/类
protected void updateDecoration(ControlDecoration decoration, RefactoringStatus status) {
RefactoringStatusEntry highestSeverity= status.getEntryWithHighestSeverity();
if (highestSeverity != null) {
Image newImage= null;
FieldDecorationRegistry registry= FieldDecorationRegistry.getDefault();
switch (highestSeverity.getSeverity()) {
case RefactoringStatus.INFO:
newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage();
break;
case RefactoringStatus.WARNING:
newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage();
break;
case RefactoringStatus.FATAL:
case RefactoringStatus.ERROR:
newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();
}
decoration.setDescriptionText(highestSeverity.getMessage());
decoration.setImage(newImage);
decoration.show();
} else {
decoration.setDescriptionText(null);
decoration.hide();
}
}
示例9: createParameterNameInput
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的package包/类
private void createParameterNameInput(Composite group) {
Label l= new Label(group, SWT.NONE);
l.setText(RefactoringMessages.ExtractClassWizard_field_name);
final Text text= new Text(group, SWT.BORDER);
fParameterNameDecoration= new ControlDecoration(text, SWT.TOP | SWT.LEAD);
text.setText(fDescriptor.getFieldName());
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
fDescriptor.setFieldName(text.getText());
validateRefactoring();
}
});
GridData gridData= new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalIndent= FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
text.setLayoutData(gridData);
}
示例10: getCueDecoration
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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;
}
示例11: initDecorators
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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();
}
示例12: decorate
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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);
}
}
示例13: getFieldDecoration
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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;
}
}
示例14: getImage
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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();
}
示例15: getImage
import org.eclipse.jface.fieldassist.FieldDecorationRegistry; //导入依赖的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();
}