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


Java FieldDecorationRegistry类代码示例

本文整理汇总了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();
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:ServerPortExtension.java

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

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

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

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

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

示例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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ExtractClassWizard.java

示例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();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:ExtractClassWizard.java

示例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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ExtractClassWizard.java

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

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

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

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

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

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


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