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


Java EContentAdapter类代码示例

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


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

示例1: listen2Model

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
/**
 * Adds a listener {@link EContentAdapter} to the {@link Ecosystem}. The listener handles updated
 * sensor values and posts them to the openhab eventbus by
 * {@link #processTFDeviceValues(Notification) processTFDeviceValues}. Furthermore the addition
 * and removal of devices is handled by {@link #initializeTFDevices(Notification)
 * initializeTFDevices}.
 *
 * @param tinkerforgeEcosystem The EMF Ecosystem object.
 */
private void listen2Model(Ecosystem tinkerforgeEcosystem) {
    EContentAdapter modelAdapter = new EContentAdapter() {
        @Override
        public void notifyChanged(Notification notification) {
            super.notifyChanged(notification);
            logger.debug("TinkerforgeNotifier was notified");
            if (notification.getEventType() == Notification.ADD
                    || notification.getEventType() == Notification.ADD_MANY
                    || notification.getEventType() == Notification.REMOVE
                    || notification.getEventType() == Notification.REMOVE_MANY) {
                initializeTFDevices(notification);
            } else {
                processTFDeviceValues(notification);
            }
        }

    };
    tinkerforgeEcosystem.eAdapters().add(modelAdapter);
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:29,代码来源:TinkerforgeBinding.java

示例2: notifyProxyResolved

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
/**
 * Creates a custom notification and sends it for proxy and loaded object. Registers adapters to loaded object.
 *
 * @param idx
 *            index in the contents list (first or second slot)
 * @param oldProxy
 *            the proxified object before being loaded
 */
protected void notifyProxyResolved(int idx, EObject oldProxy) {
	if (eNotificationRequired() && idx < contents.size()) {
		EObject newObject = contents.basicGet(idx);
		Notification notification = new NotificationImpl(Notification.RESOLVE, oldProxy, newObject) {
			@Override
			public Object getNotifier() {
				return N4JSResource.this;
			}

			@Override
			public int getFeatureID(Class<?> expectedClass) {
				return RESOURCE__CONTENTS;
			}
		};
		eNotify(notification);
		for (Adapter adapter : eAdapters()) {
			if (adapter instanceof EContentAdapter && !newObject.eAdapters().contains(adapter)) {
				newObject.eAdapters().add(adapter);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:31,代码来源:N4JSResource.java

示例3: init

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
@Inject @Optional
private void init(@UIEventTopic(TermSuiteEvents.EDITOR_INITIATED) Object part, MPart mPart) {
	if(this == part) {
		EPipeline pipeline = (EPipeline) context.get(TermSuiteUI.INPUT_OBJECT);
		this.pipelineValue.setValue(pipeline);
		this.context.set(EPipeline.class, pipeline);
		pipeline.eAdapters().add(new EContentAdapter() {
			public void notifyChanged(Notification notification) {
				super.notifyChanged(notification);
				if(notification.getFeature().equals(TermsuiteuiPackage.eINSTANCE.getEPipeline_Name())) {
					mPart.setLabel(notification.getNewStringValue());
				} else {
					// set dirty, unless this is a pipeline rename
					dirty.setDirty(true);
					validatePipeline();
				}
			}
		});
		validatePipeline();
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:22,代码来源:PipelinePart.java

示例4: listen2Model

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
/**
 * Adds a listener {@link EContentAdapter} to the {@link Ecosystem}. The listener handles updated
 * sensor values and posts them to the openhab eventbus by
 * {@link #processTFDeviceValues(Notification) processTFDeviceValues}. Furthermore the addition
 * and removal of devices is handled by {@link #initializeTFDevices(Notification)
 * initializeTFDevices}.
 * 
 * @param tinkerforgeEcosystem The EMF Ecosystem object.
 */
private void listen2Model(Ecosystem tinkerforgeEcosystem) {
  EContentAdapter modelAdapter = new EContentAdapter() {
    @Override
    public void notifyChanged(Notification notification) {
      super.notifyChanged(notification);
      logger.debug("TinkerforgeNotifier was notified");
      if (notification.getEventType() == Notification.ADD
          || notification.getEventType() == Notification.ADD_MANY
          || notification.getEventType() == Notification.REMOVE
          || notification.getEventType() == Notification.REMOVE_MANY) {
        initializeTFDevices(notification);
      } else {
        processTFDeviceValues(notification);
      }
    }

  };
  tinkerforgeEcosystem.eAdapters().add(modelAdapter);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:29,代码来源:TinkerforgeBinding.java

示例5: init

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
@Inject @Optional
	private void init(@UIEventTopic(TermSuiteEvents.EDITOR_INITIATED) Object part, MPart mPart) {
		if(this == part) {
			ETerminology terminology = (ETerminology)context.get(TermSuiteUI.INPUT_OBJECT);
			terminology.eAdapters().add(new EContentAdapter() {
				public void notifyChanged(Notification notification) {
					super.notifyChanged(notification);
					if(notification.getFeature().equals(TermsuiteuiPackage.eINSTANCE.getETerminology_Name())) {
						mPart.setLabel(toPartLabel(terminology));
					} else {
						// set dirty
//						dirty.setDirty(true);
					}
				}
			});
			final IndexedCorpus indexedCorpus = eTerminologyService.readTerminology(terminology);
			context.set(IndexedCorpus.class, indexedCorpus);
			context.set(Terminology.class, indexedCorpus.getTerminology());
			final TerminologyService terminologyService = eTerminologyService.getTerminologyService(terminology);
			context.set(TerminologyService.class, terminologyService);
			Job job = Job.create("Open terminology", monitor -> {
				sync.asyncExec(() -> viewer.setInput(terminologyService));
				return Status.OK_STATUS;
			});
			job.schedule();
		}
	}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:28,代码来源:TerminologyPart.java

示例6: init

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	setSite(site);
	setInput(input);

	fSaveAction= ActionFactory.SAVE.create(getSite().getWorkbenchWindow());
	site.getActionBars().setGlobalActionHandler(ActionFactory.SAVE.getId(), fSaveAction);
	site.getActionBars().updateActionBars();
	
	FileEditorInput i = (FileEditorInput) input;
	try {
		node = MarketplaceSerializer.loadNode(i.getPath().toFile());
	} catch (Exception e) {
		// TODO: Notify about error loading
	}
	if (node==null) {
		node = MarketplaceFactory.eINSTANCE.createNode();
	}
	// detect changes
	EContentAdapter adapter = new EContentAdapter() {
		@Override
		public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
			super.notifyChanged(notification);				
			dirty = true;
			SolutionEditor.this.firePropertyChange(IEditorPart.PROP_DIRTY);
			SolutionEditor.this.setPartName(getSolutionTitle());
		}
	};
	node.eAdapters().add(adapter);
	adapter.setTarget(node);
	setPartName(getSolutionTitle());
	firePropertyChange(IEditorPart.PROP_DIRTY);
}
 
开发者ID:Itema-as,项目名称:dawn-marketplace-server,代码行数:34,代码来源:SolutionEditor.java

示例7: testHandleContentAdapter

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
@Test public void testHandleContentAdapter() throws Exception {
	EPackage root = createExample();
	EContentAdapter eContentAdapter = new EContentAdapter();
	root.eAdapters().add(eContentAdapter);
	IReferableElementsUnloader.GenericUnloader genericUnloader = new IReferableElementsUnloader.GenericUnloader();
	try {
		genericUnloader.unloadRoot(root);
	} catch (StackOverflowError e) {
		e.printStackTrace();
		fail("Unload does not cope with contentAdpaters");
	}
	// isEmtpy() does not work in EMF 3.5
	assertEquals(0, root.eAdapters().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:GenericUnloaderTest.java

示例8: addGeometry

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
@Override
public void addGeometry(Geometry geom) {
	super.addGeometry(geom);

	if (fxAttachmentNode == null) {
		fxAttachmentNode = new Group();
	}

	if (knownParts == null) {
		knownParts = new ArrayList<>();
	}

	// If the geometry is not recognized, add it
	if (!knownParts.contains(geom)) {

		// Register to listen for changes from the geometry or its children
		// INodes
		geom.eAdapters().add(new EContentAdapter() {

			@Override
			public void notifyChanged(Notification notification) {
				handleUpdate(geom, notification);
			}
		});

		// Add the geometry to the list of known parts
		knownParts.add(geom);

		// Have the geometry refreshed when it is added
		handleUpdate(geom, null);

	}
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:34,代码来源:FXAttachment.java

示例9: EObjectWrapper

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
public EObjectWrapper(T master, List<T> slaves)
{
	this.slaves = slaves;
	this.master = master;

	this.master.eAdapters().add(new EContentAdapter()
	{
		@Override
		public void notifyChanged(Notification notification)
		{
			super.notifyChanged(notification);
			
			// Mind only 1-6 : SET, UNSET, ADD, REMOVE, ADD_ALL, REMOVE_ALL
			if (notification.getEventType() > 6 || notification.getEventType()<1)
				return;

			for (EObject slave : EObjectWrapper.this.slaves)
			{
				if (notification.getNotifier() != EObjectWrapper.this.master)
				{
					if (((EObject)notification.getNotifier()).eContainer() == null) return;

					String relativeURIFragmentPath = EcoreUtil.getRelativeURIFragmentPath(
							EObjectWrapper.this.master,
							(EObject) notification.getNotifier());

					EObject subSlave = EcoreUtil.getEObject(slave, relativeURIFragmentPath);
					pushToSlave(subSlave, notification);
				}
				else
				{
					pushToSlave(slave, notification);
				}

			}
		}
	});
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:39,代码来源:EObjectWrapper.java

示例10: initModiscoListener

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
private void initModiscoListener()
{
	this.modiscoConfiguration.eAdapters().add(new EContentAdapter(){
		@Override
		public void notifyChanged(Notification msg)
		{
			if (msg.getEventType() == Notification.RESOLVE) return;
			setDirty(true);
		}
	});
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:12,代码来源:InputAlternative.java

示例11: init

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
@Override
public void init(IInternalNodeConnection connection) {
    super.init(connection);
    if (initializationRequired) {
        connection.getNode().eAdapters().add(new EContentAdapter() {
            @Override
            public void notifyChanged(Notification msg) {
                if (msg.getFeature() == ClickWatchModelPackage.eINSTANCE.getNode_Elements() || 
                        msg.getFeature() == ClickWatchModelPackage.eINSTANCE.getElement_Children() ||
                        msg.getFeature() == ClickWatchModelPackage.eINSTANCE.getElement_Handlers()) {
                    if (!metaDataMightHaveChanged) {
                        logger.log(ILogger.DEBUG, "HandlerEventAdapter realized that meta-data has changed", null);
                    }
                    metaDataMightHaveChanged = true;
                    
                }
                super.notifyChanged(msg);
            }

            @Override
            protected void selfAdapt(Notification notification) {
                if (!(notification.getNotifier() instanceof Handler)) {
                    super.selfAdapt(notification);
                }
            }                             
        });
        initializationRequired = false;
    }
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:30,代码来源:HandlerEventAdapter.java

示例12: SimpleModelChangeListenerAddon

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
public SimpleModelChangeListenerAddon(final IExecutionEngine engine) {
	this.engine = engine;
	changes = new HashMap<>();
	registeredAddons = new HashSet<>();
	adapter = new EContentAdapter() {

		@Override
		public void notifyChanged(Notification notification) {
			super.notifyChanged(notification);
			int eventType = notification.getEventType();
			Object notifier = notification.getNotifier();
			if (eventType < Notification.EVENT_TYPE_COUNT && notifier instanceof EObject && !notification.isTouch()) {
				switch (notification.getEventType()) {
				case Notification.ADD:
				case Notification.ADD_MANY:
					addFeatureChange((EStructuralFeature) notification.getFeature(),
							(EObject) notification.getNotifier(), notification.getNewValue(),
							FieldChange.ChangeType.ADD);
					break;
				case Notification.REMOVE:
				case Notification.REMOVE_MANY:
					addFeatureChange((EStructuralFeature) notification.getFeature(),
							(EObject) notification.getNotifier(), notification.getOldValue(),
							FieldChange.ChangeType.REMOVE);
					break;
				case Notification.MOVE:
				case Notification.SET:
				case Notification.UNSET:
					addFeatureChange((EStructuralFeature) notification.getFeature(),
							(EObject) notification.getNotifier(), notification.getNewValue(),
							FieldChange.ChangeType.MODIFY);
					break;
				}
			}
		}
	};
	Set<Resource> allResources = org.eclipse.gemoc.commons.eclipse.emf.EMFResource.getRelatedResources(this.engine
			.getExecutionContext().getResourceModel());
	allResources.stream().forEach(r -> {
		if (r != null) {
			r.eAdapters().add(adapter);
		}
	});
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:45,代码来源:SimpleModelChangeListenerAddon.java

示例13: registerListeners

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
protected void registerListeners() {

		super.registerControlListeners();
		
		HyVarRecButtonListener hyVarRecButtonListener = new HyVarRecButtonListener();
		ButtonListener buttonListener = new ButtonListener();
		
		selectedConfiguration.eAdapters().add(new EContentAdapter() {
			@Override
			public void notifyChanged(Notification notification) {
				super.notifyChanged(notification);

				selectedConfigurationComposite.setConfiguration(selectedConfiguration, getCurrentSelectedDate());
			}
		});

		validateWithEvolutionButton.addSelectionListener(hyVarRecButtonListener);
		explainWithEvolutionButton.addSelectionListener(hyVarRecButtonListener);
		
		validateContextButton.addSelectionListener(hyVarRecButtonListener);
		explainButton.addSelectionListener(hyVarRecButtonListener);

		simulateButton.addSelectionListener(hyVarRecButtonListener);
		
		checkSatisfiabilityButton.addSelectionListener(buttonListener);
		checkConfigurationValidity.addSelectionListener(buttonListener);

//		numberOfPossibleConfigurationsButton.addSelectionListener(new SelectionAdapter() {
//			@Override
//			public void widgetSelected(SelectionEvent e) {
//				//calculateNumberOfPossibleConfigurations();
//			}
//		});

		selectedConfigurationComposite.getCompleteButton().addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				//autoCompleteVersions();
			}
		});

		selectedConfigurationComposite.getSaveConfigurationButton().addSelectionListener(new DwSaveConfigurationListener(this));
		
		selectedConfigurationComposite.getLoadConfigurationButton().addSelectionListener(new DwLoadConfigurationListener(this));

		selectedConfigurationComposite.getDeriveVariantButton().addSelectionListener(new DwDeriveVariantListener(this));
	}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:48,代码来源:DwFeatureModelConfiguratorEditor.java

示例14: updateAdapters

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
protected void updateAdapters( )
{
	EObject model = getChartModelObject( );
	
	if ( container instanceof ChartWizard )
	{
		// Refresh all adapters
		EContentAdapter adapter = ( (ChartWizard) container ).getAdapter( );

		model.eAdapters( ).remove( adapter );
		TreeIterator<EObject> iterator = model.eAllContents( );
		while ( iterator.hasNext( ) )
		{
			EObject oModel = iterator.next( );
			oModel.eAdapters( ).remove( adapter );
		}
		model.eAdapters( ).add( adapter );
	}
	else
	{
		// For extension case, create an adapter and add change listener
		EList<Adapter> adapters = model.eAdapters( );
		if ( adapters.isEmpty( ) )
		{
			// Get the previous adapter if existent
			if ( adapter == null )
			{
				adapter = new ChartAdapter( container );
				adapter.addListener( this );
			}
			adapters.add( adapter );
		}
		else
		{
			if ( adapters.get( 0 ) instanceof ChartAdapter )
			{
				( (ChartAdapter) adapters.get( 0 ) ).addListener( this );
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:42,代码来源:TaskSelectType.java

示例15: getAdapter

import org.eclipse.emf.ecore.util.EContentAdapter; //导入依赖的package包/类
public EContentAdapter getAdapter( )
{
	return adapter;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:5,代码来源:ChartWizard.java


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