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


Java IObservableValue类代码示例

本文整理汇总了Java中org.eclipse.core.databinding.observable.value.IObservableValue的典型用法代码示例。如果您正苦于以下问题:Java IObservableValue类的具体用法?Java IObservableValue怎么用?Java IObservableValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IObservableValue类属于org.eclipse.core.databinding.observable.value包,在下文中一共展示了IObservableValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupBindings

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
private void setupBindings() {
	// Final property binding

	if (null != finalAnnotationBox) {
		@SuppressWarnings("unchecked")
		IObservableValue<Boolean> finalValue = BeanProperties
				.value(N4JSClassWizardModel.class, N4JSClassWizardModel.FINAL_ANNOTATED_PROPERTY)
				.observe(model);
		@SuppressWarnings("unchecked")
		IObservableValue<Boolean> finalUI = WidgetProperties.selection().observe(finalAnnotationBox);
		getDataBindingContext().bindValue(finalUI, finalValue);
	}

	// n4js annotation property binding

	@SuppressWarnings("unchecked")
	IObservableValue<Boolean> n4jsValue = BeanProperties
			.value(N4JSClassWizardModel.class, N4JSClassifierWizardModel.N4JS_ANNOTATED_PROPERTY)
			.observe(model);
	@SuppressWarnings("unchecked")
	IObservableValue<Boolean> n4jsUI = WidgetProperties.selection().observe(n4jsAnnotationBox);

	getDataBindingContext().bindValue(n4jsUI, n4jsValue);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:OtherClassifierModifiersComponent.java

示例2: createStandardLinkText

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
public void createStandardLinkText ( final Composite parent, final String linkFactory, final String attributeName, final String label, final String textMessage, final ConfigurationEditorInput input, final Object valueType )
{
    this.toolkit.createLabel ( parent, label + ":" );

    final Text text = this.toolkit.createText ( parent, "" );
    text.setMessage ( textMessage );
    text.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, true, true ) );
    text.setToolTipText ( textMessage );

    final IObservableValue value = Observables.observeMapEntry ( input.getDataMap (), attributeName, valueType );
    this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), value );

    final Hyperlink link = this.toolkit.createHyperlink ( parent, "link", SWT.NONE );
    link.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, false, false ) );

    link.addHyperlinkListener ( new HyperlinkAdapter () {

        @Override
        public void linkActivated ( final HyperlinkEvent e )
        {
            EditorHelper.handleOpen ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getActivePage (), input.getConnectionUri (), linkFactory, text.getText () );
        }
    } );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:25,代码来源:ConfigurationFormToolkit.java

示例3: createStandardCombo

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
public void createStandardCombo ( final Composite parent, final String attributeName, final String label, final String[] items, final IObservableMap data, final Object valueType )
{
    this.toolkit.createLabel ( parent, label + ":" );

    final Combo combo = new Combo ( parent, SWT.DROP_DOWN );

    combo.setItems ( items );
    this.toolkit.adapt ( combo );

    final GridData gd = new GridData ( GridData.FILL, GridData.BEGINNING, true, true );
    gd.horizontalSpan = 2;
    combo.setLayoutData ( gd );

    final IObservableValue value = Observables.observeMapEntry ( data, attributeName, valueType );
    this.dbc.bindValue ( WidgetProperties.text ().observe ( combo ), value );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:ConfigurationFormToolkit.java

示例4: bind

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
public static Collection<Binding> bind ( final DataBindingContext dbc, final IObservableValue lineInputObservable, final IObservableValue linePropertiesObservable )
{
    final Collection<Binding> result = new LinkedList<Binding> ();

    try
    {
        result.add ( dbc.bindValue ( PojoObservables.observeDetailValue ( lineInputObservable, "lineWidth", null ), EMFObservables.observeDetailValue ( dbc.getValidationRealm (), linePropertiesObservable, ChartPackage.Literals.LINE_PROPERTIES__WIDTH ) ) ); //$NON-NLS-1$
        result.add ( dbc.bindValue ( PojoObservables.observeDetailValue ( lineInputObservable, "lineColor", null ), EMFObservables.observeDetailValue ( dbc.getValidationRealm (), linePropertiesObservable, ChartPackage.Literals.LINE_PROPERTIES__COLOR ) ) ); //$NON-NLS-1$
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to bind line properties", e ); //$NON-NLS-1$
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:LinePropertiesBinder.java

示例5: setupProjectSelectorDataBinding

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
private void setupProjectSelectorDataBinding() {
  IViewerObservableValue projectInput =
      ViewerProperties.input().observe(projectSelector.getViewer());
  IViewerObservableValue projectSelection =
      ViewerProperties.singleSelection().observe(projectSelector.getViewer());
  bindingContext.addValidationStatusProvider(
      new ProjectSelectionValidator(projectInput, projectSelection, requireValues));

  IViewerObservableValue projectList =
      ViewerProperties.singleSelection().observe(projectSelector.getViewer());
  IObservableValue projectIdModel = PojoProperties.value("projectId").observe(model);

  UpdateValueStrategy gcpProjectToProjectId =
      new UpdateValueStrategy().setConverter(new GcpProjectToProjectIdConverter());
  UpdateValueStrategy projectIdToGcpProject =
      new UpdateValueStrategy().setConverter(new ProjectIdToGcpProjectConverter());

  bindingContext.bindValue(projectList, projectIdModel,
      gcpProjectToProjectId, projectIdToGcpProject);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:21,代码来源:AppEngineDeployPreferencesPanel.java

示例6: createComposite

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
@PostConstruct
public void createComposite(Composite parent) {
	GridLayoutFactory.fillDefaults().applyTo(parent);
	Checkbox checkbox = new Checkbox(parent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(checkbox);
	checkbox.setSelection(true);
	checkbox.setText("Custom checkbox with databinding");
	
	Label label = new Label(parent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(label);
	
	DataBindingContext dbc = new DataBindingContext();
	
	IObservableValue checkboxProperty = CustomWidgetProperties.selection().observe(checkbox);
	ISWTObservableValue labelProperty = WidgetProperties.text().observe(label);
	
	dbc.bindValue(labelProperty, checkboxProperty);
	
	Button checkButton = new Button(parent, SWT.CHECK);
	checkButton.setSelection(true);
	checkButton.setText("Usual SWT check button");
}
 
开发者ID:vogellacompany,项目名称:swt-custom-widgets,代码行数:23,代码来源:DatabindingCustomWidgetPart.java

示例7: testBindByExpression

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
@Test
public void testBindByExpression() {
	Binder binder = Binder.create(null);
	assertNotNull(binder);

	IObservableValue targetObservableValue = new WritableValue();
	Company company = new Company();
	company.setName("A0");
	binder.bind(targetObservableValue, company, "{path=name}");
	assertEquals("A0", targetObservableValue.getValue());
	
	company.setName("A1");
	assertEquals("A1", targetObservableValue.getValue());
	
	targetObservableValue.setValue("B0");
	assertEquals("B0", company.getName());
}
 
开发者ID:erdalkaraca,项目名称:lambda-ui,代码行数:18,代码来源:BinderTest.java

示例8: initializeRoleDescBindings

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
private DataBindingContext initializeRoleDescBindings(BTSDBCollectionRoleDesc dBRoleDesc)
{
	getEditingDomain(dBRoleDesc);
	if (dbRoleDesc_bindingContext != null)
	{
		dbRoleDesc_bindingContext.dispose();
	}
	DataBindingContext bindingContext = new DataBindingContext();

	// db collection name - cannot be changed
	IObservableValue model_na = EMFProperties.value(BtsmodelPackage.Literals.BTSDB_COLLECTION_ROLE_DESC__ROLE_NAME)
			.observe(dBRoleDesc);
	bindingContext.bindValue(
			WidgetProperties.text(SWT.Modify).observeDelayed(
					BTSUIConstants.DELAY, roles_rolesDesc_name_text),
			model_na, null, null);
	return bindingContext;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:UserManagementPart.java

示例9: observeTextContent

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
/**
 * Adds a change listener to each sentence in this text in order to update
 * sentence translations in translation part representation.
 * In case there are active listeners on observables from previous input,
 * those are unregistered beforehand.
 * @param text
 */
private void observeTextContent(BTSText text) {
	try {
		// unregister any listeners on previously known text contents
		unobserveTextContent();
		for (BTSTextItems ti : text.getTextContent().getTextItems()) {
			if (ti instanceof BTSSenctence) {
				BTSSenctence sentence = (BTSSenctence)ti;
				IObservableValue<?> valProp =
						EMFObservables.observeValue(sentence, BtsmodelPackage.Literals.BTS_TRANSLATION__VALUE);
				valProp.addChangeListener(getSentenceTranslationChangeListener());
				observableSentences.add(valProp);
			}
		}
	} catch (NullPointerException e) {
		//
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:25,代码来源:EgyTextTranslationPart.java

示例10: initCustomDataBindings

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
private void initCustomDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();

    UpdateValueStrategy defaultStrategy = new UpdateValueStrategy();

    IObservableValue<String> observedNewName = WidgetProperties.text(SWT.Modify).observe(textNewName);
    IObservableValue<String> observedNewAlias = new WritableValue<String>("", String.class);
    if (aliasIsAvailable) {
        observedNewAlias = WidgetProperties.text(SWT.Modify).observe(textNewAlias);
    }

    MultiValidator nameAndAliasValidator = new NameAndAliasValidator(observedNewName, observedNewAlias,
            elementNameMightBeEmpty);
    bindingContext.addValidationStatusProvider(nameAndAliasValidator);
    IObservableValue<String> validatedNewName = nameAndAliasValidator.observeValidatedValue(observedNewName);
    IObservableValue<String> validatedNewAlias = nameAndAliasValidator.observeValidatedValue(observedNewAlias);

    bindingContext.bindValue(validatedNewName, newName, defaultStrategy, defaultStrategy);
    bindingContext.bindValue(validatedNewAlias, newAlias, defaultStrategy, defaultStrategy);

    aggregatedStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY);
    aggregatedStatus.addChangeListener(aggregatedStatusListener);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:24,代码来源:RenameUMLElementRefactoringWizardUserPageComposite.java

示例11: coalesceElements

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
@Override
protected Object coalesceElements(Collection elements) {
	Date earliest = null;
	Date latest = null;
	for (Object o : elements) {
		IObservableValue v = (IObservableValue) o;
		Date value = (Date) v.getValue();
		if (value == null) {
			continue;
		}
		if (earliest == null || value.before(earliest)) {
			earliest = value;
		}
		if (latest == null || value.after(latest)) {
			latest = value;
		}
	}
	if (latest == null || earliest == null) {
		return Amount.valueOf(0L, SI.MILLI(SI.SECOND));
	}
	return Amount.valueOf(latest.getTime() - earliest.getTime(), SI.MILLI(SI.SECOND));
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:TemporalPropertyDescriptorContributor.java

示例12: bindEditabilityAndCalculatedVariable

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
private void bindEditabilityAndCalculatedVariable(DataBindingContext dbc, EObject target, Object feature, Control control) {
	ISWTObservableValue textEditability = SWTObservables.observeEnabled(control);
	IObservableValue calculatedVariableValue = observeCalculatedVariable(target);
	final CalculatedVariable calculatedVariable = getCalculatedVariable(feature);
	UpdateValueStrategy calculatedVariableToEditability = new UpdateValueStrategy() {
		@Override
		public Object convert(Object value) {
			if (value instanceof Set) {
				return !(((Set) value).contains(calculatedVariable));
			}
			if (value == calculatedVariable) {
				return false;
			}
			return true;
		}
	};
	Binding editabilityBinding = dbc.bindValue(textEditability, calculatedVariableValue, null, calculatedVariableToEditability);
	dbc.addBinding(editabilityBinding);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:TemporalDetailProvider.java

示例13: attachListener

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
public void attachListener(EObject target, final DetailProviderParameter parameter, final UniqueMultiselectWidget widget) {
	
	EStructuralFeature feature = (EStructuralFeature) parameter.getPropertyDescriptor().getFeature(target);
	final IObservableValue modelObservable = EMFObservables.observeValue(target, feature);
	final IValueChangeListener listener = new IValueChangeListener() {
		@Override
		public void handleValueChange(ValueChangeEvent event) {
			widget.updateWidget(getValues(parameter));
		}

	};
	modelObservable.addValueChangeListener(listener);
	widget.getControl().addDisposeListener(new DisposeListener() {
		@Override
		public void widgetDisposed(DisposeEvent e) {
			modelObservable.removeValueChangeListener(listener);
		}

	});
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:21,代码来源:UniqueMultiSelectBindingFactory.java

示例14: bindValidatorDecoration

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
public static void bindValidatorDecoration(DetailProviderParameter parameter, final Control control) {
	final EObject target = parameter.getTarget();
	IItemPropertyDescriptor pd = parameter.getPropertyDescriptor();
	final EStructuralFeature feature = (EStructuralFeature) pd.getFeature(target);
	addControl(target, feature, control);
	final IObservableValue modelObservable = EMFObservables.observeValue(target, feature);
	final IValueChangeListener listener = new IValueChangeListener() {
		@Override
		public void handleValueChange(ValueChangeEvent event) {
			Object value = event.getObservableValue().getValue();
			validateFeatureValue(target, feature, value, control, true);
		}
	};
	modelObservable.addValueChangeListener(listener);
	control.addDisposeListener(new DisposeListener() {
		@Override
		public void widgetDisposed(DisposeEvent e) {
			modelObservable.removeValueChangeListener(listener);
			modelObservable.dispose();
			removeControl(target, feature, control);
			control.removeDisposeListener(this);
		}
	});
	validateFeatureValue(target, feature, modelObservable.getValue(), control, false);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:26,代码来源:EMFDetailUtils.java

示例15: bindControlViability

import org.eclipse.core.databinding.observable.value.IObservableValue; //导入依赖的package包/类
public static void bindControlViability(DetailProviderParameter p, Control[] controls) {
	EObject eObject = p.getTarget();
	IDetailProvider provider = EMFUtils.adapt(eObject, IDetailProvider.class);
	if (!(provider instanceof DetailProvider)) {
		return;
	}
	IItemPropertyDescriptor pDescriptor = p.getPropertyDescriptor();
	if (!pDescriptor.canSetProperty(eObject)) {
		return;
	}
	IObservableValue observable = ((DetailProvider) provider).getEditabilityObservable(p);
	if (observable != null) {
		DataBindingContext dbc = p.getDataBindingContext();
		bindControlViability(dbc, observable, controls);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:EMFDetailUtils.java


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