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


Java IChangeListener类代码示例

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


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

示例1: reloadOnValueChange

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
public void reloadOnValueChange(EObject eobject, EStructuralFeature feature){
	
	long id = (((long)eobject.hashCode()) << 32) + feature.getFeatureID();
	
	if(externalObservables.containsKey(id)){
		return;
	}
	
	TransactionalEditingDomain ed = TransactionalEditingDomain.Factory.INSTANCE.getEditingDomain(
       		eobject.eResource().getResourceSet());
	
	IObservableList o = EMFEditObservables.observeList(ed, eobject, feature);
	o.addChangeListener(new IChangeListener() {
		
		@Override
		public void handleChange(ChangeEvent event) {
			reload();
		}
	});
	
	externalObservables.put(id, o);
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:23,代码来源:TreeRow.java

示例2: reloadOnListChange

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
public void reloadOnListChange(EObject eobject, EStructuralFeature feature){

		long id = (((long)eobject.hashCode()) << 32) + feature.getFeatureID();

		if(externalObservables.containsKey(id)){
			return;
		}

		TransactionalEditingDomain ed = TransactionalEditingDomain.Factory.INSTANCE.getEditingDomain(
        		eobject.eResource().getResourceSet());
		
		IObservableValue o = EMFEditObservables.observeValue(ed, eobject, feature);
		o.addChangeListener(new IChangeListener() {
			
			@Override
			public void handleChange(ChangeEvent event) {
				reload();
			}
		});

		externalObservables.put(id, o);
	}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:23,代码来源:TreeRow.java

示例3: SensidlProjectWizardComposite

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
public SensidlProjectWizardComposite(Composite parent, int style, SensidlProjectDTO sensidlProjectDTO, IChangeListener sensidlProjectStatusListener) {
	super(parent, style);
	
	this.sensidlProjectStatusListener = sensidlProjectStatusListener;
	
	setLayout(new GridLayout(1, false));
	
	Group grp = new Group(this, SWT.NONE);
	grp.setLayout(new GridLayout(2, false));
	GridData gd_grp = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	gd_grp.minimumHeight = 150;
	gd_grp.heightHint = 156;
	grp.setLayoutData(gd_grp);
	grp.setText("SensIDL Project Settings");
	
	Label lblSensidlFileName = new Label(grp, SWT.NONE);
	lblSensidlFileName.setText("SensIDL file name:");
	
	txtSensidlFileName = new Text(grp, SWT.BORDER);
	txtSensidlFileName.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
	
	createDataBindings(sensidlProjectDTO);
}
 
开发者ID:SENSIDL-PROJECT,项目名称:SensIDL,代码行数:24,代码来源:SensidlProjectWizardComposite.java

示例4: ConfigurationEditorInput

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
public ConfigurationEditorInput ( final String connectionUri, final String factoryId, final String configurationId )
{
    this.connectionUri = connectionUri;
    this.factoryId = factoryId;
    this.configurationId = configurationId;

    this.dataMap.addChangeListener ( new IChangeListener () {

        @Override
        public void handleChange ( final ChangeEvent event )
        {
            ConfigurationEditorInput.this.dirtyValue.setValue ( true );
        }
    } );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:16,代码来源:ConfigurationEditorInput.java

示例5: createBasicControl

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
private void createBasicControl(Composite container) {
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 6;
	layout.verticalSpacing = 10;
	layout.marginTop = 10;
	layout.marginWidth = 10;
	createErrorLabel(container);
	createColumnInfoControl(container);
	final ISWTObservableValue observableValue = SWTObservables.observeText(errorLabel);
	errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
	dataBindingContext.bindValue(observableValue, new AggregateValidationStatus(dataBindingContext.getBindings(),
			AggregateValidationStatus.MAX_SEVERITY), null, null);
	observableValue.addChangeListener(new IChangeListener() {
		public void handleChange(ChangeEvent event) {
			if (observableValue.getValue().equals("OK")) {
				errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
				errorLabel.setText(DIALOG_MESSAGE);
				buttonOk.setEnabled(true);
			} else {
				errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
				buttonOk.setEnabled(false);
			}
		}
	});

}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:28,代码来源:ColumnDialog.java

示例6: aggregateValidationStatus

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
/**
 * aggregates the validation status for given {@link DataBindingContext}
 *
 * @param bindingContext
 * @return
 */
public static AggregateValidationStatus aggregateValidationStatus(final DataBindingContext bindingContext) {
	final AggregateValidationStatus aggregateStatus = new AggregateValidationStatus(bindingContext,
			AggregateValidationStatus.MAX_SEVERITY);
	aggregateStatus.addChangeListener(new IChangeListener() {

		@Override
		public void handleChange(final ChangeEvent event) {
			// TODO refactor - can lead to StackOverflowError
			for (final Object o : bindingContext.getBindings()) {
				final Binding binding = (Binding) o;
				final IStatus status = (IStatus) binding.getValidationStatus().getValue();

				Control control = null;
				if (binding.getTarget() instanceof ISWTObservableValue) {
					final ISWTObservableValue swtObservableValue = (ISWTObservableValue) binding.getTarget();
					control = (Control) swtObservableValue.getWidget();
				}
				final ControlDecoration decoration = decorations.get(control);
				if (decoration != null && !control.isDisposed()) {
					if (status.isOK()) {
						decoration.hide();
					} else {
						decoration.setDescriptionText(status.getMessage());
						decoration.show();
					}
				}
			}
		}
	});
	return aggregateStatus;

}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:39,代码来源:BindingHelper.java

示例7: addChangeListener

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
@Override
public void addChangeListener ( final IChangeListener listener )
{
    this.data.addChangeListener ( listener );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:6,代码来源:FolderObserver.java

示例8: removeChangeListener

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
@Override
public void removeChangeListener ( final IChangeListener listener )
{
    this.data.removeChangeListener ( listener );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:6,代码来源:FolderObserver.java

示例9: initDataBindings

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
protected DataBindingContext initDataBindings()
{
	final DataBindingContext bindingContext = new DataBindingContext();
	//
	IObservableValue observeTextTextServerURLObserveWidget = WidgetProperties.text(SWT.Modify).observeDelayed(
			BTSUIConstants.DELAY, textServerURL);
	IObservableValue bytesUrlObserveValue = PojoProperties.value("url").observe(connection);
	UpdateValueStrategy strategy = new UpdateValueStrategy();
	strategy.setAfterGetValidator(new StringHttp_s_URLValidator());
	Binding binding0 = bindingContext.bindValue(observeTextTextServerURLObserveWidget, bytesUrlObserveValue,
			strategy, null);
	BackgroundControlDecorationSupport.create(binding0, SWT.TOP | SWT.LEFT);

	//
	IObservableValue observeTextTextObserveWidget = WidgetProperties.text(SWT.Modify).observeDelayed(BTSUIConstants.DELAY, text);
	IObservableValue bytesUsernameObserveValue = PojoProperties.value("user").observe(connection);
	UpdateValueStrategy strategy_1 = new UpdateValueStrategy();
	strategy_1.setAfterGetValidator(new StringNotEmptyValidator());
	Binding binding1 = bindingContext.bindValue(observeTextTextObserveWidget, bytesUsernameObserveValue,
			strategy_1, null);
	BackgroundControlDecorationSupport.create(binding1, SWT.TOP | SWT.LEFT);

	//
	IObservableValue observeTextText_1ObserveWidget = WidgetProperties.text(SWT.Modify).observeDelayed(BTSUIConstants.DELAY,
			text_1);
	IObservableValue bytesPasswordObserveValue = PojoProperties.value("password").observe(connection);
	UpdateValueStrategy strategy_2 = new UpdateValueStrategy();
	strategy_2.setAfterGetValidator(new StringNotEmptyValidator());
	Binding binding2 = bindingContext.bindValue(observeTextText_1ObserveWidget, bytesPasswordObserveValue,
			strategy_2, null);
	BackgroundControlDecorationSupport.create(binding2, SWT.TOP | SWT.LEFT);

	//
	uiElement = WidgetProperties.text().observe(errorLabelServer);  
	// This one listenes to all changes
	bindingContext.bindValue(uiElement, new AggregateValidationStatus(bindingContext.getBindings(),
			AggregateValidationStatus.MAX_SEVERITY), null, null);
	// Lets change the color of the field lastName
	uiElement.addChangeListener(new IChangeListener()
	{
		@Override
		public void handleChange(ChangeEvent event)
		{
			boolean allcomplete = true;
			for (Object o : bindingContext.getBindings())
			{
				Binding binding = (Binding) o;
				IStatus status = (IStatus) binding.getValidationStatus().getValue();
				Control control = null;
				if (binding.getTarget() instanceof SWTVetoableValueDecorator)
				{
					SWTVetoableValueDecorator deco = (SWTVetoableValueDecorator) binding.getTarget();
					control = (Control) deco.getWidget();
					setWidgetBackground(control, status);

				}
				if (!status.isOK())
				{
					allcomplete = false;
				}
			}
			setPageComplete(allcomplete);

		}
	});
	return bindingContext;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:68,代码来源:ConnectToServerPage.java

示例10: ProjectPropertiesComposite

import org.eclipse.core.databinding.observable.IChangeListener; //导入依赖的package包/类
/**
 * Creates the composite.
 * 
 * @param parent
 *            The parent composite.
 * @param style
 *            Style which will be used.
 * @param preferencesDTO
 *            Stores connection information.
 * @param validatorStatusListener
 *            The IChangeListener used for the validator.
 */
public ProjectPropertiesComposite(Composite parent, int style, ProjectPropertiesDTO preferencesDTO,
        IChangeListener validatorStatusListener) {
    super(parent, style);
    this.preferencesDTO = preferencesDTO;
    this.validatorStatusListener = validatorStatusListener;

    setLayout(new GridLayout(1, false));

    Group grpCdo = new Group(this, SWT.NONE);
    grpCdo.setLayout(new GridLayout(2, false));
    GridData gdGrpCdo = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gdGrpCdo.minimumHeight = 150;
    gdGrpCdo.heightHint = 156;
    grpCdo.setLayoutData(gdGrpCdo);
    grpCdo.setText("CDO");

    Label lblHostname = new Label(grpCdo, SWT.NONE);
    lblHostname.setText("Hostname:");
    txtCDOHostname = new Text(grpCdo, SWT.BORDER);
    txtCDOHostname.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Accessible accLblHostname = lblHostname.getAccessible();
    Accessible accTxtHostname = txtCDOHostname.getAccessible();
    accLblHostname.addRelation(ACC.RELATION_LABEL_FOR, accTxtHostname);
    accTxtHostname.addRelation(ACC.RELATION_LABELLED_BY, accLblHostname);

    Label lblPort = new Label(grpCdo, SWT.NONE);
    lblPort.setText("Port:");
    txtCDOPort = new Text(grpCdo, SWT.BORDER);
    txtCDOPort.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
    Accessible accLblPort = lblPort.getAccessible();
    Accessible accTxtPort = txtCDOPort.getAccessible();
    accLblPort.addRelation(ACC.RELATION_LABEL_FOR, accTxtPort);
    accTxtPort.addRelation(ACC.RELATION_LABELLED_BY, accLblPort);

    Label lblRepository = new Label(grpCdo, SWT.NONE);
    lblRepository.setText("Repository:");
    txtCDORepository = new Text(grpCdo, SWT.BORDER);
    txtCDORepository.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Accessible accLblRepository = lblRepository.getAccessible();
    Accessible accTxtRepository = txtCDORepository.getAccessible();
    accLblRepository.addRelation(ACC.RELATION_LABEL_FOR, accTxtRepository);
    accTxtRepository.addRelation(ACC.RELATION_LABELLED_BY, accLblRepository);

    Label lblUsername = new Label(grpCdo, SWT.NONE);
    lblUsername.setText("Username:");
    txtCDOUsername = new Text(grpCdo, SWT.BORDER);
    txtCDOUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Accessible accLblUsername = lblUsername.getAccessible();
    Accessible accTxtUsername = txtCDOUsername.getAccessible();
    accLblUsername.addRelation(ACC.RELATION_LABEL_FOR, accTxtUsername);
    accTxtUsername.addRelation(ACC.RELATION_LABELLED_BY, accLblUsername);

    Label lblPassword = new Label(grpCdo, SWT.NONE);
    lblPassword.setText("Password:");
    txtCDOPassword = new Text(grpCdo, SWT.BORDER | SWT.PASSWORD);
    txtCDOPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Accessible accLblPassword = lblPassword.getAccessible();
    Accessible accTxtPassword = txtCDOPassword.getAccessible();
    accLblPassword.addRelation(ACC.RELATION_LABEL_FOR, accTxtPassword);
    accTxtPassword.addRelation(ACC.RELATION_LABELLED_BY, accLblPassword);

    mBindingContext = createDataBindings();
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:76,代码来源:ProjectPropertiesComposite.java


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