org.eclipse.xtext.xtype.XtypeFactory Java Examples
The following examples show how to use
org.eclipse.xtext.xtype.XtypeFactory.
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: RewritableImportSection.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
public boolean addStaticImport(JvmDeclaredType type, String memberName) { if (hasStaticImport(staticImports, type, memberName)) { return false; } Maps2.putIntoSetMap(type, memberName, staticImports); XImportDeclaration importDeclaration = XtypeFactory.eINSTANCE.createXImportDeclaration(); importDeclaration.setImportedType(type); importDeclaration.setStatic(true); if (memberName == null) { importDeclaration.setWildcard(true); } else { importDeclaration.setMemberName(memberName); } addedImportDeclarations.add(importDeclaration); return true; }
Example #2
Source File: RewritableImportSection.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
public boolean addStaticExtensionImport(JvmDeclaredType type, String memberName) { if (hasStaticImport(staticExtensionImports, type, memberName)) { return false; } Maps2.putIntoSetMap(type, memberName, staticExtensionImports); XImportDeclaration importDeclaration = XtypeFactory.eINSTANCE.createXImportDeclaration(); importDeclaration.setImportedType(type); importDeclaration.setStatic(true); importDeclaration.setExtension(true); if (memberName == null) { importDeclaration.setWildcard(true); } else { importDeclaration.setMemberName(memberName); } addedImportDeclarations.add(importDeclaration); return true; }
Example #3
Source File: RewritableImportSection.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
public void update() { XImportSection importSection = importsConfiguration.getImportSection(resource); if (importSection == null && importsConfiguration instanceof IMutableImportsConfiguration) { importSection = XtypeFactory.eINSTANCE.createXImportSection(); IMutableImportsConfiguration mutableImportsConfiguration = (IMutableImportsConfiguration) importsConfiguration; mutableImportsConfiguration.setImportSection(resource, importSection); } if (importSection == null) { return; } removeObsoleteStaticImports(); List<XImportDeclaration> allImportDeclarations = newArrayList(); allImportDeclarations.addAll(originalImportDeclarations); allImportDeclarations.addAll(addedImportDeclarations); allImportDeclarations.removeAll(removedImportDeclarations); List<XImportDeclaration> importDeclarations = importSection.getImportDeclarations(); importDeclarations.clear(); importDeclarations.addAll(allImportDeclarations); }
Example #4
Source File: RewritableImportSection.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
public boolean addImport(JvmDeclaredType type) { if (plainImports.containsKey(type.getSimpleName()) || !needsImport(type)) return false; Maps2.putIntoListMap(type.getSimpleName(), type, plainImports); XImportDeclaration importDeclaration = XtypeFactory.eINSTANCE.createXImportDeclaration(); importDeclaration.setImportedType(type); addedImportDeclarations.add(importDeclaration); return true; }
Example #5
Source File: RewritableImportSection.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected XImportDeclaration createImport(String importedNamespace, final String member) { XImportDeclaration importDeclaration = XtypeFactory.eINSTANCE.createXImportDeclaration(); importDeclaration.setImportedNamespace(importedNamespace); if (member != null) { importDeclaration.setMemberName(member); } return importDeclaration; }
Example #6
Source File: ScriptBuilderImpl.java From sarl with Apache License 2.0 | 5 votes |
/** Finalize the script. * * <p>The finalization includes: <ul> * <li>The import section is created.</li> * </ul> */ public void finalizeScript() { if (this.isFinalized) { throw new IllegalStateException("already finalized"); } this.isFinalized = true; ImportManager concreteImports = new ImportManager(true); XImportSection importSection = getScript().getImportSection(); if (importSection != null) { for (XImportDeclaration decl : importSection.getImportDeclarations()) { concreteImports.addImportFor(decl.getImportedType()); } } for (String importName : getImportManager().getImports()) { JvmType type = findType(getScript(), importName).getType(); if (concreteImports.addImportFor(type) && type instanceof JvmDeclaredType) { XImportDeclaration declaration = XtypeFactory.eINSTANCE.createXImportDeclaration(); declaration.setImportedType((JvmDeclaredType) type); if (importSection == null) { importSection = XtypeFactory.eINSTANCE.createXImportSection(); getScript().setImportSection(importSection); } importSection.getImportDeclarations().add(declaration); } } Resource resource = getScript().eResource(); if (resource instanceof DerivedStateAwareResource) { ((DerivedStateAwareResource) resource).discardDerivedState(); } }
Example #7
Source File: CommonTypeComputationServices.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public XtypeFactory getXtypeFactory() { return xtypeFactory; }
Example #8
Source File: CommonTypeComputationServices.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public void setXtypeFactory(XtypeFactory xtypeFactory) { this.xtypeFactory = xtypeFactory; }
Example #9
Source File: DefaultXbaseRuntimeModule.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public XtypeFactory bindXtypeFactoryToInstance() { return XtypeFactory.eINSTANCE; }
Example #10
Source File: XtypePackageImpl.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public XtypeFactory getXtypeFactory() { return (XtypeFactory)getEFactoryInstance(); }
Example #11
Source File: XtypePackageImpl.java From xtext-extras with Eclipse Public License 2.0 | 2 votes |
/** * Creates an instance of the model <b>Package</b>, registered with * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package * package URI value. * <p>Note: the correct way to create the package is via the static * factory method {@link #init init()}, which also performs * initialization of the package, or returns the registered package, * if one already exists. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.eclipse.emf.ecore.EPackage.Registry * @see org.eclipse.xtext.xtype.XtypePackage#eNS_URI * @see #init() * @generated */ private XtypePackageImpl() { super(eNS_URI, XtypeFactory.eINSTANCE); }