當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。