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


Java EObject类代码示例

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


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

示例1: persistMetamodel

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
public static void persistMetamodel(ResourceSet resourceSet, EPackage generated, String path) throws IOException {
	if (new File(path).exists()) {
		EPackage existing = (EPackage) OcciHelper.getRootElement(resourceSet, "file:/" + path);
		for (Iterator<EObject> iterator = existing.eAllContents(); iterator.hasNext();) {
			EObject eo = iterator.next();
			if (eo instanceof EAnnotation && isOCLRelated((EAnnotation) eo)) {
				EModelElement existingContainer = (EModelElement) eo.eContainer();
				EModelElement generatedContainer = (EModelElement) getGeneratedElement(generated,
						existingContainer);
				if (generatedContainer == null) {
					throw new RuntimeException("Unable to find " + existingContainer + " to reattach " + eo + " "
							+ ((EAnnotation) eo).getEAnnotations());
				} else {
					generatedContainer.getEAnnotations().add((EAnnotation) EcoreUtil.copy(eo));
				}
			}
		}
	}
	ConverterUtils.save(resourceSet, generated, "file:/" + path);
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:21,代码来源:ConverterUtils.java

示例2: getProbableThisTarget

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * The heuristically computed this target, but not the directly containing function, in which the expression (or any
 * other object) is (indirectly) contained, may be null. This typically is an {@link ObjectLiteral}, an
 * {@link N4ClassDeclaration}, or another outer {@link FunctionDefinition}. Note that for expressions contained in
 * property name value pairs, it is <b>not</b> the object literal.
 * <p>
 * cf. ECMAScript spec 10.4.3 Entering Function Code
 * </p>
 */
public static ThisTarget getProbableThisTarget(EObject location) {
	if (location == null || location.eContainer() == null) {
		return null;
	}

	final ThisArgProvider thisArgProvider = location instanceof N4MethodDeclaration ? (N4MethodDeclaration) location
			: EcoreUtil2.getContainerOfType(location.eContainer(), ThisArgProvider.class);
	if (thisArgProvider == null) {
		return null;
	}

	final ThisTarget thisTarget = EcoreUtil2.getContainerOfType(thisArgProvider.eContainer(), ThisTarget.class);
	if (thisTarget != null) {
		ThisArgProvider indirectThisArgProvider = EcoreUtil2.getContainerOfType(thisArgProvider.eContainer(),
				ThisArgProvider.class);
		if (indirectThisArgProvider != null && EcoreUtil.isAncestor(thisTarget, indirectThisArgProvider)) {
			return null; // nested function
		}
	}
	return thisTarget;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:31,代码来源:N4JSASTUtils.java

示例3: create

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override
public EObject create(EClass eClass)
{
  switch (eClass.getClassifierID())
  {
    case RepetitionPackage.COLUMN_MAPPING: return createColumnMapping();
    case RepetitionPackage.FOR_EACH_REPETITION: return createForEachRepetition();
    case RepetitionPackage.FOR_EACH_XPATH_REPETITION: return createForEachXPathRepetition();
    case RepetitionPackage.FOR_REPETITION: return createForRepetition();
    case RepetitionPackage.FOR_REPETITION_ITERATOR: return createForRepetitionIterator();
    case RepetitionPackage.XPATH_MAPPING: return createXPathMapping();
    default:
      throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
  }
}
 
开发者ID:Morgan-Stanley,项目名称:Saturn,代码行数:20,代码来源:RepetitionFactoryImpl.java

示例4: merge

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
private void merge(final EObject extension, final EObject extendsEObject, final Map<String, EObject> idToEObject) {
    mergeAttributes(extension, extendsEObject);
    mergeCrossReferences(extension, extendsEObject, idToEObject);
    for (final EObject extensionChild : extension.eContents()) {
        final String uriFragment = uriFragmentBuilder.getURIFragment(extensionChild);
        if (idToEObject.containsKey(uriFragment)) {
            final EObject extendsChild = idToEObject.get(uriFragment);
            merge(extensionChild, extendsChild, idToEObject);
        } else {
            final EObject copy = copy(extensionChild);
            final EReference containmentFeature = extensionChild.eContainmentFeature();
            if (containmentFeature.isMany()) {
                final List<EObject> containment = (List<EObject>) extendsEObject.eGet(containmentFeature);
                containment.add(copy);
            } else {
                extendsEObject.eSet(containmentFeature, copy);
            }
        }
    }
}
 
开发者ID:vrapio,项目名称:rest-modeling-framework,代码行数:21,代码来源:RamlModelBuilder.java

示例5: addProcessingUnits

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * 
 */
protected void addProcessingUnits() {
	TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(processingUnits.getInput(),
			processingUnitsFilters, processingUnitsBusinessFilters, "processingUnits",
			propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
		@Override
		public void process(IStructuredSelection selection) {
			for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
				EObject elem = (EObject) iter.next();
				propertiesEditionComponent
						.firePropertiesChanged(new PropertiesEditionEvent(GeneralPropertiesEditionPartImpl.this,
								SrmViewsRepository.General.Properties.processingUnits,
								PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
			}
			processingUnits.refresh();
		}
	};
	dialog.open();
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:22,代码来源:GeneralPropertiesEditionPartImpl.java

示例6: run

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * Real job
 * 
 * @throws TraceException
 */
public boolean run() throws TraceException {
  setState(RUNNING);
  atom2EClass.clear();

  for (String alias : alias2Item.keySet()) {
    EObject eObject = alias2Item.get(alias).modelRoot;
    if (eObject instanceof EPackage) {
      EPackage ePackage = (EPackage) eObject;
      final String selectedClass = alias2Item.get(alias).containerClassName;
      EClass refClass = EcoreUtilities.findEClass(alias2Item.get(alias).modelRoot, selectedClass);
      if (refClass != null) {
        EObject container = ePackage.getEFactoryInstance().create(refClass);
        alias2Item.get(alias).container = container;
      }
    }
  }
  createEClassesFromAtoms();
  createEReferencesFromSigs();
  setState(FINISHED);
  return true;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:27,代码来源:AlloyToEMF.java

示例7: create

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public EObject create(EClass eClass) {
	switch (eClass.getClassifierID()) {
		case LNGroupRPackage.GROUP_R: return createGroupR();
		case LNGroupRPackage.RDRE: return createRDRE();
		case LNGroupRPackage.RDRS: return createRDRS();
		case LNGroupRPackage.RPSB: return createRPSB();
		case LNGroupRPackage.RBRF: return createRBRF();
		case LNGroupRPackage.RADR: return createRADR();
		case LNGroupRPackage.RBDR: return createRBDR();
		case LNGroupRPackage.RDIR: return createRDIR();
		case LNGroupRPackage.RFLO: return createRFLO();
		case LNGroupRPackage.RREC: return createRREC();
		case LNGroupRPackage.RSYN: return createRSYN();
		default:
			throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
	}
}
 
开发者ID:SvenPeldszus,项目名称:rgse.ttc17.emoflon.tgg,代码行数:24,代码来源:LNGroupRFactoryImpl.java

示例8: addWriteServices

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * 
 */
protected void addWriteServices() {
	TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(writeServices.getInput(),
			writeServicesFilters, writeServicesBusinessFilters, "writeServices",
			propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
		@Override
		public void process(IStructuredSelection selection) {
			for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
				EObject elem = (EObject) iter.next();
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
						OtherPropertiesEditionPartForm.this, SrmViewsRepository.Other.Properties.writeServices,
						PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
			}
			writeServices.refresh();
		}
	};
	dialog.open();
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:21,代码来源:OtherPropertiesEditionPartForm.java

示例9: validate

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
@Override
public boolean validate ( final EObject eObject, final DiagnosticChain diagnostics, final Map<Object, Object> context )
{
    boolean result = true;
    for ( final EValidator v : this.otherValidators )
    {
        if ( !v.validate ( eObject, diagnostics, context ) )
        {
            result = false;
        }
    }

    ValidationPlugin.runValidation ( eObject, diagnostics, context );

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

示例10: addDelayServices

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * 
 */
protected void addDelayServices() {
	TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(delayServices.getInput(),
			delayServicesFilters, delayServicesBusinessFilters, "delayServices",
			propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
		@Override
		public void process(IStructuredSelection selection) {
			for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
				EObject elem = (EObject) iter.next();
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
						OtherPropertiesEditionPartImpl.this, SrmViewsRepository.Other.Properties.delayServices,
						PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
			}
			delayServices.refresh();
		}
	};
	dialog.open();
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:21,代码来源:OtherPropertiesEditionPartImpl.java

示例11: create

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public EObject create(EClass eClass) {
	switch (eClass.getClassifierID()) {
		case InfMeteringPackage.WATER_METERING_FUNCTION: return createWaterMeteringFunction();
		case InfMeteringPackage.GAS_METERING_FUNCTION: return createGasMeteringFunction();
		case InfMeteringPackage.METERING_FUNCTION_CONFIGURATION: return createMeteringFunctionConfiguration();
		case InfMeteringPackage.COM_PORT: return createComPort();
		default:
			throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
	}
}
 
开发者ID:georghinkel,项目名称:ttc2017smartGrids,代码行数:17,代码来源:InfMeteringFactoryImpl.java

示例12: removeFromWorkload

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * 
 */
protected void removeFromWorkload(EObject element) {
	propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
			GeneralPropertiesEditionPartForm.this, GrmViewsRepository.General.Properties.workload,
			PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element));
	workload.refresh();
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:10,代码来源:GeneralPropertiesEditionPartForm.java

示例13: isFactoryForType

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * Returns whether this factory is applicable for the type of the object.
 * <!-- begin-user-doc -->
 * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
 * <!-- end-user-doc -->
 * @return whether this factory is applicable for the type of the object.
 * @generated
 */
@Override
public boolean isFactoryForType(Object object) {
	if (object == modelPackage) {
		return true;
	}
	if (object instanceof EObject) {
		return ((EObject)object).eClass().getEPackage() == modelPackage;
	}
	return false;
}
 
开发者ID:georghinkel,项目名称:ttc2017smartGrids,代码行数:19,代码来源:DomainLNsAdapterFactory.java

示例14: hasBeenActivated

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * Tells if the given {@link EObject instruction} is a currently
 * {@link IModelAnimator#activate(LogicalStep) activated}.
 * 
 * This service works in a similar way as {@link  AbstractGemocDebuggerServices isCurrentInstruction} 
 * but will be activated even if the engine in not paused in order to act as an animation.
 * 
 * @param instruction
 *            the {@link EObject instruction}
 * @return <code>true</code> if the given {@link EObject instruction} is a
 *         currently {@link IModelAnimator#activate(LogicalStep) activated},
 *         <code>false</code> otherwise
 */
public boolean hasBeenActivated(EObject instruction) {
	boolean res = false;

	final URI uri = EcoreUtil.getURI(instruction);
	for (Set<URI> instructions : ANIMATOR.activatedInstructions.values()) {
		if (instructions.contains(uri)) {
			res = true;
			break;
		}
	}

	return res;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:27,代码来源:AbstractGemocAnimatorServices.java

示例15: editCommunicationsAffectedOn

import org.eclipse.emf.ecore.EObject; //导入依赖的package包/类
/**
 * @generated
 */
protected void editCommunicationsAffectedOn(EObject element) {
	EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(propertiesEditionComponent.getEditingContext(), propertiesEditionComponent, element, adapterFactory);
	PropertiesEditingProvider provider = (PropertiesEditingProvider)adapterFactory.adapt(element, PropertiesEditingProvider.class);
	if (provider != null) {
		PropertiesEditingPolicy policy = provider.getPolicy(context);
		if (policy != null) {
			policy.execute();
			communicationsAffectedOn.refresh();
		}
	}
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:15,代码来源:CommunicationResourcePropertiesEditionPartForm.java


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