org.eclipse.emf.common.notify.Notifier Java Examples
The following examples show how to use
org.eclipse.emf.common.notify.Notifier.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeReferences.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
/** * @return a fresh {@link JvmMultiTypeReference} pointing to the given references or null if {@link Object} is not * on the context's class path */ public JvmMultiTypeReference createMultiTypeReference(Notifier context, JvmTypeReference... references) { if (context == null) throw new NullPointerException("context"); JvmMultiTypeReference result = factory.createJvmMultiTypeReference(); if (references != null && references.length != 0) { for (JvmTypeReference reference : references) { result.getReferences().add(createDelegateTypeReference(reference)); } } final JvmType findDeclaredType = findDeclaredType(Object.class, context); if (findDeclaredType == null) return null; result.setType(findDeclaredType); return result; }
Example #2
Source File: ResourceSetBasedSlotEntry.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Override protected List<EObject> findEObjectsOfType(Set<EClass> eClasses, IResourceDescriptions resourceDescriptions, ResourceSet resourceSet) { List<EObject> result = Lists.newArrayList(); for (Resource resource : resourceSet.getResources()) { if (!resource.isLoaded()) { try { resource.load(null); } catch (IOException e) { throw new WrappedException(e); } } } for (Iterator<Notifier> i = resourceSet.getAllContents(); i.hasNext();) { Notifier next = i.next(); if (next instanceof EObject && matches(eClasses, (EObject) next)) { result.add((EObject) next); } } return result; }
Example #3
Source File: OriginalElement.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
public static OriginalElement removeFromEmfObject(Notifier emfObject) { List<Adapter> adapters = emfObject.eAdapters(); for (int i = 0, max = adapters.size(); i < max; i++) { Adapter adapter = adapters.get(i); if (adapter instanceof OriginalElement.OriginalElementAdapter) { emfObject.eAdapters().remove(i); return ((OriginalElement.OriginalElementAdapter) adapter).get(); } } return null; }
Example #4
Source File: FlattenedGrammarAccess.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
public static FlattenedGrammarAccess removeFromEmfObject(Notifier emfObject) { List<Adapter> adapters = emfObject.eAdapters(); for (int i = 0; i < adapters.size(); i++) { Adapter adapter = adapters.get(i); if (adapter instanceof FlattenedGrammarAccessAdapter) return ((FlattenedGrammarAccessAdapter) emfObject.eAdapters().remove(i)).get(); } return null; }
Example #5
Source File: ChunkedResourceDescriptions.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
public static ChunkedResourceDescriptions removeFromEmfObject(Notifier emfObject) { List<Adapter> adapters = emfObject.eAdapters(); for (int i = 0; i < adapters.size(); i++) { Adapter adapter = adapters.get(i); if (adapter instanceof ChunkedResourceDescriptionsAdapter) return ((ChunkedResourceDescriptionsAdapter) emfObject.eAdapters().remove(i)).get(); } return null; }
Example #6
Source File: GenconfUtils.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
/** * Initializes the {@link Generation#getDefinitions() variable definitions} from the given {@link Generation} with the given * {@link ResourceSet}. * * @param generation * the {@link Generation} to initialize * @param queryEnvironment * the {@link IReadOnlyQueryEnvironment} * @param properties * the {@link TemplateCustomProperties} * @param resourceSetForModels * the {@link ResourceSet} to get values from */ public static void initializeVariableDefinition(Generation generation, IReadOnlyQueryEnvironment queryEnvironment, TemplateCustomProperties properties, ResourceSet resourceSetForModels) { final AstValidator validator = new AstValidator(new ValidationServices(queryEnvironment)); final Map<ModelDefinition, Set<IType>> toInitialilize = new HashMap<ModelDefinition, Set<IType>>(); for (Definition definition : generation.getDefinitions()) { if (definition instanceof ModelDefinition && ((ModelDefinition) definition).getValue() == null) { final ModelDefinition modelDefinition = (ModelDefinition) definition; final Set<IType> possibleTypes = properties.getVariableTypes(validator, queryEnvironment, properties.getVariables().get(modelDefinition.getKey())); toInitialilize.put(modelDefinition, possibleTypes); } } final Iterator<Notifier> it = resourceSetForModels.getAllContents(); while (!toInitialilize.isEmpty() && it.hasNext()) { final Notifier notifier = it.next(); if (notifier instanceof EObject) { EObject element = (EObject) notifier; final EClassifierType elementType = new EClassifierType(queryEnvironment, element.eClass()); ModelDefinition initialized = null; for (Entry<ModelDefinition, Set<IType>> entry : toInitialilize.entrySet()) { for (IType definitionType : entry.getValue()) { if (definitionType.isAssignableFrom(elementType)) { initialized = entry.getKey(); initialized.setValue(element); } } } if (initialized != null) { toInitialilize.remove(initialized); } } } }
Example #7
Source File: AnnotationLookup.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
public JvmAnnotationReference findOrAddAnnotation(/* @NonNull */ JvmAnnotationTarget annotationTarget, /* @NonNull */ Notifier context, /* @NonNull */ Class<? extends Annotation> type) { JvmAnnotationReference result = findAnnotation(annotationTarget, type); if (result != null) return result; JvmAnnotationType annotationType = findAnnotationType(type, context); if (annotationType != null) { result = typesFactory.createJvmAnnotationReference(); result.setAnnotation(annotationType); return result; } return null; }
Example #8
Source File: RuleWithParameterValues.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
public static RuleWithParameterValues findInEmfObject(Notifier emfObject) { for (Adapter adapter : emfObject.eAdapters()) { if (adapter instanceof RuleWithParameterValues.RuleWithParameterValuesAdapter) { return ((RuleWithParameterValues.RuleWithParameterValuesAdapter) adapter).get(); } } return null; }
Example #9
Source File: ClassFileCache.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
public void attachToEmfObject(Notifier emfObject) { ClassFileCache result = findInEmfObject(emfObject); if (result != null) throw new IllegalStateException("The given EMF object already contains an adapter for ClassFileCache"); ClassFileCache.ClassFileCacheAdapter adapter = new ClassFileCache.ClassFileCacheAdapter(this); emfObject.eAdapters().add(adapter); }
Example #10
Source File: CompositeNodeWithSemanticElement.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public void setTarget(Notifier newTarget) { if (newTarget == null || newTarget instanceof EObject) semanticElement = (EObject) newTarget; else throw new IllegalArgumentException("Notifier must be an Eobject"); }
Example #11
Source File: EcoreUtil2.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
public static ResourceSet getResourceSet(Notifier ctx) { if (ctx instanceof EObject) { Resource eResource = ((EObject) ctx).eResource(); if (eResource != null) return eResource.getResourceSet(); } else if (ctx instanceof Resource) { return ((Resource) ctx).getResourceSet(); } else if (ctx instanceof ResourceSet) { return (ResourceSet) ctx; } return null; }
Example #12
Source File: TypeReferences.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
/** * @return a fresh {@link JvmAnyTypeReference} or null if {@link Object} is not on the context's classpath */ public JvmAnyTypeReference createAnyTypeReference(Notifier context) { if (context == null) throw new NullPointerException("context"); JvmAnyTypeReference result = factory.createJvmAnyTypeReference(); final JvmType objectType = findDeclaredType(Object.class, context); if (objectType == null) return null; result.setType(objectType); return result; }
Example #13
Source File: TypeReferences.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
public JvmTypeReference getTypeForName(String typeName, Notifier context, JvmTypeReference... params) { if (typeName == null) throw new NullPointerException("typeName"); JvmType declaredType = findDeclaredType(typeName, context); if (declaredType == null) return getUnknownTypeReference(typeName); JvmParameterizedTypeReference result = createTypeRef(declaredType, params); return result; }
Example #14
Source File: ClassFileCache.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
public static ClassFileCache removeFromEmfObject(Notifier emfObject) { List<Adapter> adapters = emfObject.eAdapters(); for (int i = 0, max = adapters.size(); i < max; i++) { Adapter adapter = adapters.get(i); if (adapter instanceof ClassFileCache.ClassFileCacheAdapter) { emfObject.eAdapters().remove(i); return ((ClassFileCache.ClassFileCacheAdapter) adapter).get(); } } return null; }
Example #15
Source File: CompositeNodeWithSemanticElement.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public Notifier getTarget() { return semanticElement; }
Example #16
Source File: TypeReferences.java From xtext-extras with Eclipse Public License 2.0 | 3 votes |
/** * looks up a JVMType corresponding to the given {@link Class}. This method ignores any Jvm types created in non- * {@link TypeResource} in the given EObject's resourceSet, but goes straight to the Java-layer, using a * {@link IJvmTypeProvider}. * * @return the JvmType with the same qualified name as the given {@link Class} object, or null if no such JvmType * could be found using the context's resourceSet. */ public JvmType findDeclaredType(Class<?> clazz, Notifier context) { if (clazz == null) throw new NullPointerException("clazz"); JvmType declaredType = findDeclaredType(clazz.getName(), context); return declaredType; }
Example #17
Source File: Bug378967TestAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #18
Source File: Bug289059TestAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #19
Source File: PartialSerializationTestLanguageAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #20
Source File: FileAwareAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #21
Source File: WfgraphAdapterFactory.java From graphical-lsp with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject) target); }
Example #22
Source File: XImportSectionTestLangAdapterFactory.java From xtext-extras with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #23
Source File: NoLiteralsAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #24
Source File: Bug289524ExTestAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #25
Source File: ModelInferenceAdapterFactory.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #26
Source File: ContentAssistContextTestAdapterFactory.java From xtext-eclipse with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #27
Source File: SuperPackageAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #28
Source File: RootAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #29
Source File: EnumRulesTestLanguageAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }
Example #30
Source File: TestLanguageAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); }