當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyValueWrapper類代碼示例

本文整理匯總了Java中org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper的典型用法代碼示例。如果您正苦於以下問題:Java PropertyValueWrapper類的具體用法?Java PropertyValueWrapper怎麽用?Java PropertyValueWrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PropertyValueWrapper類屬於org.eclipse.emf.edit.provider.ItemPropertyDescriptor包,在下文中一共展示了PropertyValueWrapper類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPropertyValue

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
public static Object getPropertyValue(IItemPropertyDescriptor pd, Object model) {
	Object value = pd.getPropertyValue(model);
	if (value instanceof PropertyValueWrapper) {
		value = ((PropertyValueWrapper)value).getEditableValue(model);
	}
	return value;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:8,代碼來源:EMFUtils.java

示例2: getText

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
protected String getText(EPlanElement pe, String key) {
	if (TimelinePreferencePage.P_DECORATOR_TEXT_KEY_NONE.equals(key)) {
		return null;
	}
	
	if (PlanTextDecoratorFieldProvider.P_DECORATOR_TEXT_KEY_NAME.equals(key)) {
		return pe.getName();
	}
	
	if (PlanTextDecoratorFieldProvider.P_DECORATOR_TEXT_KEY_NOTES.equals(key)) {
		return pe.getMember(CommonMember.class).getNotes();
	}
	
	EObject object = pe.getData();
	IItemPropertySource source = EMFUtils.adapt(object, IItemPropertySource.class);
	if (source != null) {
		EStructuralFeature f = object.eClass().getEStructuralFeature(key);
		if (f != null) {
			IItemPropertyDescriptor pd = source.getPropertyDescriptor(object, f);
			if (pd != null) {
				IItemLabelProvider lp = pd.getLabelProvider(object);
				if (lp != null) {
					Object value = pd.getPropertyValue(object);
					if (value instanceof PropertyValueWrapper) {
						value = ((PropertyValueWrapper)value).getEditableValue(object);
					}
					return lp.getText(value);
				}
			}
		}
	}
	return null;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:34,代碼來源:TemporalNodeDecoratorTextEditPolicy.java

示例3: updateValidityColor

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
/**
 * Sets the validity color according to the current text.
 * 
 * ShowTip, determines if a "tip" about the error should be displayed
 */
private void updateValidityColor(final Text text, final EObject eObject, IItemPropertyDescriptor pd, final IStringifier<Object> stringifier, final boolean showTip) {
	try {
		// Don't update the validity color if the Text has an associated error decoration from EMF validation
		if (!EMFDetailUtils.hasErrorDecoration(text)) {
			text.setForeground(VALID_COLOR);
			// Default control tooltip description
			EMFDetailUtils.addDescriptionTooltip(pd, eObject, text);
		}
		Object value = pd.getPropertyValue(eObject);
		if (value instanceof PropertyValueWrapper) {
			value = ((PropertyValueWrapper)value).getEditableValue(eObject);
		}
		Object parsedValue = null;
		if (stringifier == null) {
			text.setForeground(INVALID_INPUT_COLOR);
			Logger.getLogger(TextBindingFactory.class).error("null stringifier for: " + pd.getDisplayName(eObject));
		} else {
			Object defaultValue = value;
			if (defaultValue==null && (IStringifier)stringifier instanceof DateStringifier) {
				Date smartDefault = DefaultDateUtil.tryHarderToFindDefaultDateIfApplicable(eObject, stringifier);
				if (smartDefault != null) defaultValue = smartDefault;
			}
			parsedValue = stringifier.getJavaObject(text.getText(), defaultValue);
		}
		if (bubbleShowing()) {
			bubble.setVisible(false);
		}
		if (parsedValue instanceof Date) {
			String toolTipText = MissionCalendarUtils.formatToolTipDate((Date)parsedValue);
			if (!toolTipText.equals(text.getText())) {
				text.setToolTipText(toolTipText);
				// SWT doesn't allow tooltips on disabled controls so add to parent as well
				text.getParent().setToolTipText(toolTipText);
			}
		}
	} catch (final ParseException pe) {
		showError(text, pe.getMessage(), showTip);
	}
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:45,代碼來源:TextBindingFactory.java

示例4: unwrapPropertyDescriptors

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
private void unwrapPropertyDescriptors(Object target, List<IItemPropertyDescriptor> list, List<IItemPropertyDescriptor> pds) {
	for (IItemPropertyDescriptor pd : pds) {
		Object value = pd.getPropertyValue(target);
		if (value instanceof PropertyValueWrapper) {
			PropertyValueWrapper wrapper = (PropertyValueWrapper)value;
			List<IItemPropertyDescriptor> unwrappedPropertyDescriptors = wrapper.getPropertyDescriptors(value);
			if (!unwrappedPropertyDescriptors.isEmpty()) {
				unwrapPropertyDescriptors(value, list, unwrappedPropertyDescriptors);
			}
		}
		list.add(pd);
	}
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:14,代碼來源:MultiItemIntersectionPropertySource.java

示例5: getRealValue

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
private String getRealValue(Object value) {
	if (value instanceof PropertyValueWrapper) {
		PropertyValueWrapper wrapper = (PropertyValueWrapper) value;
		return wrapper.getText(wrapper);
	}
	return "";
}
 
開發者ID:SOM-Research,項目名稱:collaboro,代碼行數:8,代碼來源:SyntaxElementPropertyDescriptor.java

示例6: getEditableValue

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
public Object getEditableValue() {
	Object value = source.getEditableValue();
	if (value instanceof PropertyValueWrapper) {
		PropertyValueWrapper wrapper = (PropertyValueWrapper) value;
		return wrapper.getEditableValue(null);
	} else {
		return source.getEditableValue();
	}
}
 
開發者ID:leondart,項目名稱:FRaMED,代碼行數:12,代碼來源:ORMGraphicalEditor.java

示例7: getPropertyValue

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
public Object getPropertyValue(final Object id) {
	final Object value = source.getPropertyValue(id);
	if (value instanceof PropertyValueWrapper) {
		PropertyValueWrapper wrapper = (PropertyValueWrapper) value;
		return wrapper.getEditableValue(null);
	} else {
		return source.getPropertyValue(id);
	}
}
 
開發者ID:leondart,項目名稱:FRaMED,代碼行數:12,代碼來源:ORMGraphicalEditor.java

示例8: createBinding

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
@Override
public Binding createBinding(DetailProviderParameter p) {
	FormToolkit toolkit = p.getDetailFormToolkit();
	Composite parent = p.getParent();
	EObject target = p.getTarget();
	IItemPropertyDescriptor pd = p.getPropertyDescriptor();

	Object propertyValueObject = pd.getPropertyValue(target);
	String propertyName = pd.getDisplayName(target);
	String propertyValue = null;
	if (propertyValueObject != null && propertyValueObject instanceof PropertyValueWrapper) {
		PropertyValueWrapper propertyValueWrapper = (PropertyValueWrapper) propertyValueObject;
		Object editableValue = propertyValueWrapper.getEditableValue(target);
		propertyValue = editableValue.toString();
	}

	if (propertyValue == null) {
		propertyValue = "";
	}

	EMFDetailUtils.createLabel(parent, toolkit, target, pd);
	Composite rootComposite = createRootComposite(toolkit, parent);
	Composite hyperlinkAndBrowseComposite = hyperlinkAndBrowseComposite(rootComposite);
	Text hyperlinkTextField = createHyperlinkTextField(hyperlinkAndBrowseComposite, propertyValue);
	@SuppressWarnings("unused")
	Button browseButton = createBrowseButton(hyperlinkAndBrowseComposite, hyperlinkTextField);
	Button openButton = createOpenButton(rootComposite, propertyName, hyperlinkTextField);
	hyperlinkAndBrowseComposite.setData(BUTTON_KEY, openButton);
	openButton.setEnabled(!hyperlinkTextField.getText().trim().equals(""));

	StringifierUpdateValueStrategy targetToModel = new StringifierUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
	StringifierUpdateValueStrategy modelToTarget = new StringifierUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
	ISWTObservableValue observeText = SWTObservables.observeText(hyperlinkTextField, SWT.FocusOut);

	EMFDetailUtils.bindValidatorDecoration(p, hyperlinkTextField);
	EMFDetailUtils.bindControlViability(p, new Control[] { browseButton, openButton, hyperlinkTextField });
	Binding binding = EMFDetailUtils.bindEMFUndoable(p, observeText, targetToModel, modelToTarget);
	EMFDetailUtils.bindTextModifyUndoable(hyperlinkTextField, target, propertyName);
	targetToModel.setBinding(binding);
	return binding;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:42,代碼來源:URLBindingFactory.java

示例9: createBinding

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
@Override
public Binding createBinding(DetailProviderParameter p) {
	FormToolkit toolkit = p.getDetailFormToolkit();
	Composite parent = p.getParent();
	EObject target = p.getTarget();
	IItemPropertyDescriptor pd = p.getPropertyDescriptor();

	Object propertyValueObject = pd.getPropertyValue(target);
	String propertyName = pd.getDisplayName(target);
	String propertyValue = null;
	if (propertyValueObject != null && propertyValueObject instanceof PropertyValueWrapper) {
		PropertyValueWrapper propertyValueWrapper = (PropertyValueWrapper) propertyValueObject;
		Object editableValue = propertyValueWrapper.getEditableValue(target);
		propertyValue = editableValue.toString();
	}

	if (propertyValue == null) {
		propertyValue = "";
	}

	uriConverter = target.eResource().getResourceSet().getURIConverter();
	projectUriStringfier = new URIStrigifier(uriConverter);
	EMFDetailUtils.createLabel(parent, toolkit, target, pd);
	Composite rootComposite = createRootComposite(toolkit, parent);
	Composite hyperlinkAndBrowseComposite = hyperlinkAndBrowseComposite(rootComposite);
	Text hyperlinkTextField = createHyperlinkTextField(hyperlinkAndBrowseComposite, propertyValue);
	Button browseButton = createBrowseButton(hyperlinkAndBrowseComposite, hyperlinkTextField);
	Button openButton = createOpenButton(rootComposite, propertyName, hyperlinkTextField);
	hyperlinkAndBrowseComposite.setData(BUTTON_KEY, openButton);
	openButton.setEnabled(!hyperlinkTextField.getText().trim().equals(""));

	StringifierUpdateValueStrategy targetToModel = new ProjectUrlUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
	StringifierUpdateValueStrategy modelToTarget = new ProjectUrlUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
	ISWTObservableValue observeText = SWTObservables.observeText(hyperlinkTextField, SWT.FocusOut);

	EMFDetailUtils.bindValidatorDecoration(p, hyperlinkTextField);
	EMFDetailUtils.bindControlViability(p, new Control[] { browseButton, openButton, hyperlinkTextField });
	Binding binding = EMFDetailUtils.bindEMFUndoable(p, observeText, targetToModel, modelToTarget);
	EMFDetailUtils.bindTextModifyUndoable(hyperlinkTextField, target, propertyName);
	targetToModel.setBinding(binding);
	return binding;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:43,代碼來源:URIBindingFactory.java

示例10: createBinding

import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper; //導入依賴的package包/類
private void createBinding(Composite parent, EObject target, IItemPropertyDescriptor pd) {
	if (pd instanceof OverrideableCommandOwner) {
		EObject owner = EMFDetailUtils.getCommandOwner(pd, target);
		if (owner != null) {
			target = owner;
		}
	}
	EStructuralFeature feature = (EStructuralFeature) pd.getFeature(target);
	if (feature != null && EMFUtils.testBooleanAnnotation(feature, EMFDetailUtils.ANNOTATION_SOURCE_DETAIL, ANNOTATION_DETAIL_HIDDEN)) {
		return;
	}
	
	IDetailProvider provider = CommonUtils.getAdapter(pd, IDetailProvider.class);
	if (provider == null) {
		provider = EMFUtils.adapt(target, IDetailProvider.class);
	}
	DetailProviderParameter parameter = createDetailProviderParameter(parent, target, pd);
	if (provider != null && provider.canCreateBindings(parameter)) {
		provider.createBinding(parameter);
		return;
	}

	Object propertyValue = pd.getPropertyValue(target);
	if (propertyValue instanceof PropertyValueWrapper) {
		PropertyValueWrapper wrapper = (PropertyValueWrapper) propertyValue;
		List<IItemPropertyDescriptor> propertyDescriptors = wrapper.getPropertyDescriptors(propertyValue);
		if (!propertyDescriptors.isEmpty()) {
			String text = wrapper.getText(propertyValue);
			Object editableValue = wrapper.getEditableValue(propertyValue);
			buildPropertySection(parent, (EObject)editableValue, propertyDescriptors, text, null);
			return;
		}
	}
	
	if (feature instanceof EReference) {
		createReferenceBinding(parent, target, pd, (EReference)feature);
	} else if (feature instanceof EAttribute){
		createAttributeBinding(parent, target, pd, (EAttribute)feature);
	} else if (pd instanceof MultiItemPropertyDescriptor) {
		pd = ((MultiItemPropertyDescriptor)pd).getPrimaryDescriptor();
		if (pd != null)
			createBinding(parent, target, pd);
	}
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:45,代碼來源:EMFDetailFormPart.java


注:本文中的org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。