本文整理匯總了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);
}
示例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;
}
示例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");
}
}
示例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);
}
}
}
}
示例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();
}
示例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;
}
示例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");
}
}
示例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();
}
示例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;
}
示例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();
}
示例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");
}
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
}
}