当前位置: 首页>>代码示例>>Java>>正文


Java FieldDecoration类代码示例

本文整理汇总了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();
}
 
开发者ID:cplutte,项目名称:bts,代码行数:41,代码来源:BackgroundControlDecorationUpdater.java

示例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;
}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:35,代码来源:BindingHelper.java

示例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;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:ThemesPreferencePage.java

示例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( );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:17,代码来源:FieldAssistHelper.java

示例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( );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:17,代码来源:FieldAssistHelper.java

示例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( );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:18,代码来源:FieldAssistHelper.java

示例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;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:24,代码来源:FieldAssistHelper.java

示例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();
}
 
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-Java,代码行数:21,代码来源:AsposeExampleWizardPage.java

示例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);
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:21,代码来源:ContactTypeDecorator.java

示例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;	
	}
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:28,代码来源:Decorators.java

示例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();
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:41,代码来源:ControlDecorationUpdater.java

示例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();
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:38,代码来源:DataBindings.java

示例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; 
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:16,代码来源:WidgetUtility.java

示例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;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:11,代码来源:ViewDataPreferencesDialog.java

示例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);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:11,代码来源:GcpLocalRunTab.java


注:本文中的org.eclipse.jface.fieldassist.FieldDecoration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。