本文整理汇总了Java中org.eclipse.jface.fieldassist.ControlDecoration.setImage方法的典型用法代码示例。如果您正苦于以下问题:Java ControlDecoration.setImage方法的具体用法?Java ControlDecoration.setImage怎么用?Java ControlDecoration.setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.fieldassist.ControlDecoration
的用法示例。
在下文中一共展示了ControlDecoration.setImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: createControlDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的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.ControlDecoration; //导入方法依赖的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: createContentAssistDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
private void createContentAssistDecoration(StyledText styledText) {
decoration = new ControlDecoration(styledText, SWT.TOP | SWT.LEFT);
decoration.setShowHover(true);
decoration.setShowOnlyOnFocus(true);
final Image image = ImageDescriptor.createFromFile(XtextStyledTextCellEditor.class,
"images/content_assist_cue.gif").createImage();
decoration.setImage(image);
decoration.setDescriptionText("Content Assist Available (CTRL + Space)");
decoration.setMarginWidth(2);
styledText.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (decoration != null) {
decoration.dispose();
}
if (image != null) {
image.dispose();
}
}
});
}
示例5: updateDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的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();
}
}
示例6: showErrorDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的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( );
}
}
示例7: showWarningDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的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( );
}
}
示例8: showContentAssistDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的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( );
}
}
示例9: initDecorators
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的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();
}
示例10: createContentProposalDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
/**
* Adds the content proposal field decoration to a given control.
*
* @param control
* The control to decorate
*/
private ControlDecoration createContentProposalDecoration(Control control) {
ControlDecoration decoration = new ControlDecoration(control, SWT.TOP | SWT.LEFT);
decoration.setImage(contentProposalDecorationImage);
decoration.setShowOnlyOnFocus(true);
return decoration;
}
示例11: addDecorator
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的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;
}
示例12: addDecorator
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的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;
}
示例13: createControl
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
@Override
protected Control createControl(Composite parent) {
super.createControl(parent);
deco = new ControlDecoration(text, decoStyle);
deco.setImage(getErrorImage());
deco.hide();
return text;
}
示例14: addBulbDecorator
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
private void addBulbDecorator(final Control control, final String tooltip) {
ControlDecoration dec = new ControlDecoration(control, SWT.TOP | SWT.LEFT);
dec.setImage(FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
dec.setShowOnlyOnFocus(true);
dec.setShowHover(true);
dec.setDescriptionText(tooltip);
}
示例15: update
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
/**
* Updates the visibility, image, and description text of the given
* ControlDecoration to represent the given status.
*
* @param decoration
* the ControlDecoration to update
* @param status
* the status to be displayed by the decoration
*/
public void update(ControlDecoration decoration, IStatus status)
{
if (status == null || status.isOK())
{
decoration.hide();
} else
{
decoration.setImage(getImage(status));
decoration.setDescriptionText(getDescriptionText(status));
decoration.show();
}
}