Java 类org.eclipse.xtext.xtype.XImportSection 实例源码

项目:xtext-extras    文件:ModelImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setImportSection(XImportSection newImportSection)
{
  if (newImportSection != importSection)
  {
    NotificationChain msgs = null;
    if (importSection != null)
      msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PureXbasePackage.MODEL__IMPORT_SECTION, null, msgs);
    if (newImportSection != null)
      msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PureXbasePackage.MODEL__IMPORT_SECTION, null, msgs);
    msgs = basicSetImportSection(newImportSection, msgs);
    if (msgs != null) msgs.dispatch();
  }
  else if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET, PureXbasePackage.MODEL__IMPORT_SECTION, newImportSection, newImportSection));
}
项目:xtext-extras    文件:XbaseValidator.java   
protected void checkConflicts(XImportSection importSection, final Map<String, List<XImportDeclaration>> imports,
        final Map<String, JvmType> importedNames) {
    for (JvmDeclaredType declaredType : importsConfiguration.getLocallyDefinedTypes((XtextResource)importSection.eResource())) {
        if(importedNames.containsKey(declaredType.getSimpleName())){
            JvmType importedType = importedNames.get(declaredType.getSimpleName());
            if (importedType != declaredType  && importedType.eResource() != importSection.eResource()) {
                List<XImportDeclaration> list = imports.get(importedType.getIdentifier());
                if (list != null) {
                    for (XImportDeclaration importDeclaration: list ) {
                        error("The import '" 
                                + importedType.getIdentifier() 
                                + "' conflicts with a type defined in the same file", 
                                importDeclaration, null, IssueCodes.IMPORT_CONFLICT);
                    }
                }
            }
        }
    }
}
项目:xtext-extras    文件:RewritableImportSection.java   
public RewritableImportSection(XtextResource resource, IImportsConfiguration importsConfiguration, XImportSection originalImportSection,
        String lineSeparator, ImportSectionRegionUtil regionUtil, IValueConverter<String> nameConverter) {
    this.importsConfiguration = importsConfiguration;
    this.resource = resource;
    this.lineSeparator = lineSeparator;
    this.regionUtil = regionUtil;
    this.nameValueConverter = nameConverter;
    this.implicitlyImportedPackages = importsConfiguration.getImplicitlyImportedPackages(resource);
    this.importRegion = regionUtil.computeRegion(resource);
    if (originalImportSection != null) {
        for (XImportDeclaration originalImportDeclaration : originalImportSection.getImportDeclarations()) {
            this.originalImportDeclarations.add(originalImportDeclaration);
            JvmDeclaredType importedType = originalImportDeclaration.getImportedType();
            if (originalImportDeclaration.isStatic()) {
                String memberName = originalImportDeclaration.getMemberName();
                if (originalImportDeclaration.isExtension()) {
                    Maps2.putIntoSetMap(importedType, memberName, staticExtensionImports);
                } else {
                    Maps2.putIntoSetMap(importedType, memberName, staticImports);
                }
            } else if (importedType != null) {
                Maps2.putIntoListMap(importedType.getSimpleName(), importedType, plainImports);
            }
        }
    }
}
项目:xtext-extras    文件:RewritableImportSection.java   
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);
}
项目:xtext-extras    文件:ImportSectionTestLanguageRootImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setImportSection(XImportSection newImportSection)
{
  if (newImportSection != importSection)
  {
    NotificationChain msgs = null;
    if (importSection != null)
      msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XImportSectionTestLangPackage.IMPORT_SECTION_TEST_LANGUAGE_ROOT__IMPORT_SECTION, null, msgs);
    if (newImportSection != null)
      msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XImportSectionTestLangPackage.IMPORT_SECTION_TEST_LANGUAGE_ROOT__IMPORT_SECTION, null, msgs);
    msgs = basicSetImportSection(newImportSection, msgs);
    if (msgs != null) msgs.dispatch();
  }
  else if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET, XImportSectionTestLangPackage.IMPORT_SECTION_TEST_LANGUAGE_ROOT__IMPORT_SECTION, newImportSection, newImportSection));
}
项目:dsl-devkit    文件:CheckCatalogImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setImports(XImportSection newImports)
{
    if (newImports != imports)
    {
        NotificationChain msgs = null;
        if (imports != null)
            msgs = ((InternalEObject)imports).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CheckPackage.CHECK_CATALOG__IMPORTS, null, msgs);
        if (newImports != null)
            msgs = ((InternalEObject)newImports).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CheckPackage.CHECK_CATALOG__IMPORTS, null, msgs);
        msgs = basicSetImports(newImports, msgs);
        if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, CheckPackage.CHECK_CATALOG__IMPORTS, newImports, newImports));
}
项目:melange    文件:ModelTypingSpaceImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
    switch (featureID) {
        case MelangePackage.MODEL_TYPING_SPACE__ELEMENTS:
            getElements().clear();
            getElements().addAll((Collection<? extends Element>)newValue);
            return;
        case MelangePackage.MODEL_TYPING_SPACE__IMPORTS:
            setImports((XImportSection)newValue);
            return;
        case MelangePackage.MODEL_TYPING_SPACE__NAME:
            setName((String)newValue);
            return;
    }
    super.eSet(featureID, newValue);
}
项目:melange    文件:ModelTypingSpaceImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID) {
    switch (featureID) {
        case MelangePackage.MODEL_TYPING_SPACE__ELEMENTS:
            getElements().clear();
            return;
        case MelangePackage.MODEL_TYPING_SPACE__IMPORTS:
            setImports((XImportSection)null);
            return;
        case MelangePackage.MODEL_TYPING_SPACE__NAME:
            setName(NAME_EDEFAULT);
            return;
    }
    super.eUnset(featureID);
}
项目:XRobot    文件:ProgramImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setImports(XImportSection newImports)
{
  if (newImports != imports)
  {
    NotificationChain msgs = null;
    if (imports != null)
      msgs = ((InternalEObject)imports).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XRobotDSLPackage.PROGRAM__IMPORTS, null, msgs);
    if (newImports != null)
      msgs = ((InternalEObject)newImports).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XRobotDSLPackage.PROGRAM__IMPORTS, null, msgs);
    msgs = basicSetImports(newImports, msgs);
    if (msgs != null) msgs.dispatch();
  }
  else if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET, XRobotDSLPackage.PROGRAM__IMPORTS, newImports, newImports));
}
项目:xtext-maven-example    文件:BuildFileImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setImportSection(XImportSection newImportSection)
{
  if (newImportSection != importSection)
  {
    NotificationChain msgs = null;
    if (importSection != null)
      msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BuildPackage.BUILD_FILE__IMPORT_SECTION, null, msgs);
    if (newImportSection != null)
      msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - BuildPackage.BUILD_FILE__IMPORT_SECTION, null, msgs);
    msgs = basicSetImportSection(newImportSection, msgs);
    if (msgs != null) msgs.dispatch();
  }
  else if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET, BuildPackage.BUILD_FILE__IMPORT_SECTION, newImportSection, newImportSection));
}
项目:xtext-maven-example    文件:BuildFileImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case BuildPackage.BUILD_FILE__NAME:
      setName((String)newValue);
      return;
    case BuildPackage.BUILD_FILE__IMPORT_SECTION:
      setImportSection((XImportSection)newValue);
      return;
    case BuildPackage.BUILD_FILE__DECLARATIONS:
      getDeclarations().clear();
      getDeclarations().addAll((Collection<? extends Declaration>)newValue);
      return;
  }
  super.eSet(featureID, newValue);
}
项目:xtext-maven-example    文件:BuildFileImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
  switch (featureID)
  {
    case BuildPackage.BUILD_FILE__NAME:
      setName(NAME_EDEFAULT);
      return;
    case BuildPackage.BUILD_FILE__IMPORT_SECTION:
      setImportSection((XImportSection)null);
      return;
    case BuildPackage.BUILD_FILE__DECLARATIONS:
      getDeclarations().clear();
      return;
  }
  super.eUnset(featureID);
}
项目:xtext-maven-example    文件:BuildFileImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setImportSection(XImportSection newImportSection)
{
  if (newImportSection != importSection)
  {
    NotificationChain msgs = null;
    if (importSection != null)
      msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BuildPackage.BUILD_FILE__IMPORT_SECTION, null, msgs);
    if (newImportSection != null)
      msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - BuildPackage.BUILD_FILE__IMPORT_SECTION, null, msgs);
    msgs = basicSetImportSection(newImportSection, msgs);
    if (msgs != null) msgs.dispatch();
  }
  else if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET, BuildPackage.BUILD_FILE__IMPORT_SECTION, newImportSection, newImportSection));
}
项目:xtext-maven-example    文件:BuildFileImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case BuildPackage.BUILD_FILE__NAME:
      setName((String)newValue);
      return;
    case BuildPackage.BUILD_FILE__IMPORT_SECTION:
      setImportSection((XImportSection)newValue);
      return;
    case BuildPackage.BUILD_FILE__DECLARATIONS:
      getDeclarations().clear();
      getDeclarations().addAll((Collection<? extends Declaration>)newValue);
      return;
  }
  super.eSet(featureID, newValue);
}
项目:xtext-maven-example    文件:BuildFileImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
  switch (featureID)
  {
    case BuildPackage.BUILD_FILE__NAME:
      setName(NAME_EDEFAULT);
      return;
    case BuildPackage.BUILD_FILE__IMPORT_SECTION:
      setImportSection((XImportSection)null);
      return;
    case BuildPackage.BUILD_FILE__DECLARATIONS:
      getDeclarations().clear();
      return;
  }
  super.eUnset(featureID);
}
项目:packtpub-xtext-book-examples    文件:ModelImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setImportSection(XImportSection newImportSection)
{
  if (newImportSection != importSection)
  {
    NotificationChain msgs = null;
    if (importSection != null)
      msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.MODEL__IMPORT_SECTION, null, msgs);
    if (newImportSection != null)
      msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.MODEL__IMPORT_SECTION, null, msgs);
    msgs = basicSetImportSection(newImportSection, msgs);
    if (msgs != null) msgs.dispatch();
  }
  else if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET, EntitiesPackage.MODEL__IMPORT_SECTION, newImportSection, newImportSection));
}
项目:packtpub-xtext-book-examples    文件:ModelImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case EntitiesPackage.MODEL__IMPORT_SECTION:
      setImportSection((XImportSection)newValue);
      return;
    case EntitiesPackage.MODEL__ENTITIES:
      getEntities().clear();
      getEntities().addAll((Collection<? extends Entity>)newValue);
      return;
  }
  super.eSet(featureID, newValue);
}
项目:xtext-extras    文件:ModelImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetImportSection(XImportSection newImportSection, NotificationChain msgs)
{
  XImportSection oldImportSection = importSection;
  importSection = newImportSection;
  if (eNotificationRequired())
  {
    ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PureXbasePackage.MODEL__IMPORT_SECTION, oldImportSection, newImportSection);
    if (msgs == null) msgs = notification; else msgs.add(notification);
  }
  return msgs;
}
项目:xtext-extras    文件:ModelImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case PureXbasePackage.MODEL__IMPORT_SECTION:
      setImportSection((XImportSection)newValue);
      return;
    case PureXbasePackage.MODEL__BLOCK:
      setBlock((XBlockExpression)newValue);
      return;
  }
  super.eSet(featureID, newValue);
}
项目:xtext-extras    文件:ModelImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
  switch (featureID)
  {
    case PureXbasePackage.MODEL__IMPORT_SECTION:
      setImportSection((XImportSection)null);
      return;
    case PureXbasePackage.MODEL__BLOCK:
      setBlock((XBlockExpression)null);
      return;
  }
  super.eUnset(featureID);
}
项目:xtext-extras    文件:XImportSectionNamespaceScopeProvider.java   
protected List<ImportNormalizer> internalGetImportedNamespaceResolvers(EObject context, boolean ignoreCase) {
    if(EcoreUtil.getRootContainer(context) != context) 
        return Collections.emptyList();
    XImportSection importSection = importsConfiguration.getImportSection((XtextResource) context.eResource());
    if(importSection != null) {
        return getImportedNamespaceResolvers(importSection, ignoreCase);
    }
    return Collections.emptyList();
}
项目:xtext-extras    文件:XImportSectionNamespaceScopeProvider.java   
protected List<ImportNormalizer> getImportedNamespaceResolvers(XImportSection importSection, boolean ignoreCase) {
    List<XImportDeclaration> importDeclarations = importSection.getImportDeclarations();
    List<ImportNormalizer> result = Lists.newArrayListWithExpectedSize(importDeclarations.size());
    for (XImportDeclaration imp: importDeclarations) {
        if (!imp.isStatic()) {
            String value = imp.getImportedNamespace();
            if(value == null)
                value = imp.getImportedTypeName();
            ImportNormalizer resolver = createImportedNamespaceResolver(value, ignoreCase);
            if (resolver != null)
                result.add(resolver);
        }
    }
    return result;
}
项目:xtext-extras    文件:XbaseBatchScopeProvider.java   
@Override
public IFeatureScopeSession newSession(Resource context) {
    List<JvmType> literalClasses = implicitlyImportedFeatures.getStaticImportClasses(context);
    List<JvmType> extensionClasses = implicitlyImportedFeatures.getExtensionClasses(context);
    IFeatureScopeSession result = rootSession.addTypesToStaticScope(literalClasses, extensionClasses);
    if (context.getContents().isEmpty() || !(context instanceof XtextResource))
        return result;
    final XImportSection importSection = importsConfig.getImportSection((XtextResource) context);
    if(importSection != null) {
        result = result.addImports(new ITypeImporter.Client() {

            @Override
            public void doAddImports(ITypeImporter importer) {
                List<XImportDeclaration> imports = importSection.getImportDeclarations();
                for(XImportDeclaration _import: imports) {
                    if (_import.isStatic()) {
                        if (_import.isWildcard()) {
                            if (_import.isExtension()) {
                                importer.importStaticExtension(_import.getImportedType(), false);
                            } else {
                                importer.importStatic(_import.getImportedType());
                            }
                        } else {
                            if (_import.isExtension()) {
                                importer.importStaticExtension(_import.getImportedType(), _import.getMemberName(), false);
                            } else {
                                importer.importStatic(_import.getImportedType(), _import.getMemberName());
                            }
                        }
                    }
                }
            }

        });
    }
    return result;
}
项目:xtext-extras    文件:ImportSectionRegionUtil.java   
public ITextRegion computeRegion(XtextResource resource) {
    XImportSection xImportSection = config.getImportSection(resource);
    // try to obtain the region from the text if it is not a synthetic region.
    if (xImportSection != null && xImportSection.eResource() != null) {
        INode node = NodeModelUtils.findActualNodeFor(xImportSection);
        if(node == null) 
            LOG.error("Cannot detect node for original import section");
        else 
            return node.getTextRegion();
    } 
    return new TextRegion(config.getImportSectionOffset(resource), 0);
}
项目:xtext-extras    文件:DefaultImportsConfiguration.java   
@Override
public XImportSection getImportSection(XtextResource resource) {
    EList<EObject> contents = resource.getContents();
    if (!contents.isEmpty())
    {
        for (Iterator<EObject> i = contents.get(0).eAllContents(); i.hasNext();) {
            EObject next = i.next();
            if (next instanceof XImportSection)
                return (XImportSection) next;
        }
    }
    return null;
}
项目:xtext-extras    文件:XtypeFormatter.java   
protected void _format(final XImportSection section, @Extension final IFormattableDocument format) {
  EList<XImportDeclaration> _importDeclarations = section.getImportDeclarations();
  for (final XImportDeclaration imp : _importDeclarations) {
    {
      format.<XImportDeclaration>format(imp);
      XImportDeclaration _last = IterableExtensions.<XImportDeclaration>last(section.getImportDeclarations());
      boolean _notEquals = (!Objects.equal(imp, _last));
      if (_notEquals) {
        format.<XImportDeclaration>append(imp, XbaseFormatterPreferenceKeys.blankLinesBetweenImports);
      } else {
        format.<XImportDeclaration>append(imp, XbaseFormatterPreferenceKeys.blankLinesAfterImports);
      }
    }
  }
}
项目:xtext-extras    文件:XtypeFormatter.java   
public void format(final Object ref, final IFormattableDocument document) {
  if (ref instanceof JvmTypeParameter) {
    _format((JvmTypeParameter)ref, document);
    return;
  } else if (ref instanceof XtextResource) {
    _format((XtextResource)ref, document);
    return;
  } else if (ref instanceof XFunctionTypeRef) {
    _format((XFunctionTypeRef)ref, document);
    return;
  } else if (ref instanceof JvmParameterizedTypeReference) {
    _format((JvmParameterizedTypeReference)ref, document);
    return;
  } else if (ref instanceof JvmWildcardTypeReference) {
    _format((JvmWildcardTypeReference)ref, document);
    return;
  } else if (ref instanceof XImportDeclaration) {
    _format((XImportDeclaration)ref, document);
    return;
  } else if (ref instanceof XImportSection) {
    _format((XImportSection)ref, document);
    return;
  } else if (ref instanceof EObject) {
    _format((EObject)ref, document);
    return;
  } else if (ref == null) {
    _format((Void)null, document);
    return;
  } else if (ref != null) {
    _format(ref, document);
    return;
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(ref, document).toString());
  }
}
项目:xtext-extras    文件:ClasspathBasedIdeTypesProposalProvider.java   
@Override
public void createTypeProposals(final EReference reference, final ContentAssistContext context, final Predicate<ITypeDescriptor> filter, final IIdeContentProposalAcceptor acceptor) {
  ITextRegion importSectionRegion = null;
  XImportSection importSection = null;
  boolean _isImportDeclaration = this.isImportDeclaration(reference, context);
  boolean _not = (!_isImportDeclaration);
  if (_not) {
    importSection = this.importsConfiguration.getImportSection(context.getResource());
    importSectionRegion = this.importSectionRegionUtil.computeRegion(context.getResource());
  }
  Iterable<ITypeDescriptor> _typeDescriptors = this.getTypeDescriptors(context);
  for (final ITypeDescriptor typeDesc : _typeDescriptors) {
    {
      boolean _canAcceptMoreProposals = acceptor.canAcceptMoreProposals();
      boolean _not_1 = (!_canAcceptMoreProposals);
      if (_not_1) {
        return;
      }
      boolean _canPropose = this.canPropose(typeDesc, context, filter);
      if (_canPropose) {
        final ContentAssistEntry entry = this.createProposal(reference, typeDesc, context, importSection, importSectionRegion);
        final int priority = ((XbaseIdeContentProposalPriorities) this.proposalPriorities).getTypeRefPriority(typeDesc, entry);
        acceptor.accept(entry, priority);
      }
    }
  }
}
项目:xtext-extras    文件:ClasspathBasedIdeTypesProposalProvider.java   
protected ContentAssistEntry createProposal(final EReference reference, final ITypeDescriptor typeDesc, final ContentAssistContext context, final XImportSection importSection, final ITextRegion importSectionRegion) {
  ContentAssistEntry _xblockexpression = null;
  {
    final boolean importDecl = this.isImportDeclaration(reference, context);
    final String qualifiedName = this.qualifiedNameConverter.toString(typeDesc.getQualifiedName());
    String _xifexpression = null;
    if (importDecl) {
      _xifexpression = qualifiedName;
    } else {
      _xifexpression = typeDesc.getSimpleName();
    }
    final String proposal = _xifexpression;
    final Procedure1<ContentAssistEntry> _function = (ContentAssistEntry it) -> {
      if (importDecl) {
        it.setLabel(typeDesc.getSimpleName());
        it.setDescription(proposal);
      } else {
        it.setDescription(qualifiedName);
        if (((importSectionRegion != null) && this.isImportDeclarationRequired(typeDesc, qualifiedName, context, importSection))) {
          this.addImportDeclaration(it, importSectionRegion, typeDesc, qualifiedName, context);
        }
      }
    };
    _xblockexpression = this.proposalCreator.createProposal(proposal, context, _function);
  }
  return _xblockexpression;
}
项目:xtext-extras    文件:ClasspathBasedIdeTypesProposalProvider.java   
protected boolean isImportDeclarationRequired(final ITypeDescriptor typeDesc, final String qualifiedName, final ContentAssistContext context, final XImportSection importSection) {
  return ((!(typeDesc.getName().startsWith("java.lang") && (typeDesc.getName().lastIndexOf(".") == 9))) && ((importSection == null) || (!IterableExtensions.<XImportDeclaration>exists(importSection.getImportDeclarations(), ((Function1<XImportDeclaration, Boolean>) (XImportDeclaration it) -> {
    JvmDeclaredType _importedType = it.getImportedType();
    String _qualifiedName = null;
    if (_importedType!=null) {
      _qualifiedName=_importedType.getQualifiedName();
    }
    return Boolean.valueOf(Objects.equal(_qualifiedName, qualifiedName));
  })))));
}
项目:xtext-extras    文件:ImportSectionTestLanguageRootImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetImportSection(XImportSection newImportSection, NotificationChain msgs)
{
  XImportSection oldImportSection = importSection;
  importSection = newImportSection;
  if (eNotificationRequired())
  {
    ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XImportSectionTestLangPackage.IMPORT_SECTION_TEST_LANGUAGE_ROOT__IMPORT_SECTION, oldImportSection, newImportSection);
    if (msgs == null) msgs = notification; else msgs.add(notification);
  }
  return msgs;
}
项目:xtext-extras    文件:ImportSectionTestLanguageRootImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case XImportSectionTestLangPackage.IMPORT_SECTION_TEST_LANGUAGE_ROOT__IMPORT_SECTION:
      setImportSection((XImportSection)newValue);
      return;
  }
  super.eSet(featureID, newValue);
}
项目:xtext-extras    文件:ImportSectionTestLanguageRootImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
  switch (featureID)
  {
    case XImportSectionTestLangPackage.IMPORT_SECTION_TEST_LANGUAGE_ROOT__IMPORT_SECTION:
      setImportSection((XImportSection)null);
      return;
  }
  super.eUnset(featureID);
}
项目:dsl-devkit    文件:CheckCatalogImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetImports(XImportSection newImports, NotificationChain msgs)
{
    XImportSection oldImports = imports;
    imports = newImports;
    if (eNotificationRequired())
    {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CheckPackage.CHECK_CATALOG__IMPORTS, oldImports, newImports);
        if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
}
项目:dsl-devkit    文件:CheckCatalogImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
    switch (featureID)
    {
        case CheckPackage.CHECK_CATALOG__PACKAGE_NAME:
            setPackageName(PACKAGE_NAME_EDEFAULT);
            return;
        case CheckPackage.CHECK_CATALOG__IMPORTS:
            setImports((XImportSection)null);
            return;
        case CheckPackage.CHECK_CATALOG__FINAL:
            setFinal(FINAL_EDEFAULT);
            return;
        case CheckPackage.CHECK_CATALOG__NAME:
            setName(NAME_EDEFAULT);
            return;
        case CheckPackage.CHECK_CATALOG__GRAMMAR:
            setGrammar((Grammar)null);
            return;
        case CheckPackage.CHECK_CATALOG__INCLUDED_CATALOGS:
            setIncludedCatalogs((CheckCatalog)null);
            return;
        case CheckPackage.CHECK_CATALOG__CATEGORIES:
            getCategories().clear();
            return;
        case CheckPackage.CHECK_CATALOG__IMPLEMENTATIONS:
            getImplementations().clear();
            return;
        case CheckPackage.CHECK_CATALOG__CHECKS:
            getChecks().clear();
            return;
        case CheckPackage.CHECK_CATALOG__MEMBERS:
            getMembers().clear();
            return;
    }
    super.eUnset(featureID);
}
项目:dsl-devkit    文件:ApiAccessChecks.java   
/**
 * Check that imports from packages designated as "API" in an extension point check API specification. If no specification, ignore.
 *
 * @param importSection
 *          import to be validated
 */
@Check
public void checkImportNonPublicApi(final XImportSection importSection) {
  if (!PUBLIC_API.isEmpty()) {
    importSection.getImportDeclarations().forEach(xImport -> {
      if (xImport.isWildcard()) {
        // We know this isn't null and ends with .* from the "isWildcard"
        String nameSpace = xImport.getImportedNamespace();
        validatePackageAccess(nameSpace.substring(0, nameSpace.length() - 2), xImport, XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE);
      } else if (xImport.getImportedType() != null) {
        validatePackageAccess(xImport.getImportedType().getPackageName(), xImport, XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE);
      }
    });
  }
}
项目:melange    文件:ModelTypingSpaceImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetImports(XImportSection newImports, NotificationChain msgs) {
    XImportSection oldImports = imports;
    imports = newImports;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MelangePackage.MODEL_TYPING_SPACE__IMPORTS, oldImports, newImports);
        if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
}
项目:melange    文件:ModelTypingSpaceImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setImports(XImportSection newImports) {
    if (newImports != imports) {
        NotificationChain msgs = null;
        if (imports != null)
            msgs = ((InternalEObject)imports).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MelangePackage.MODEL_TYPING_SPACE__IMPORTS, null, msgs);
        if (newImports != null)
            msgs = ((InternalEObject)newImports).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MelangePackage.MODEL_TYPING_SPACE__IMPORTS, null, msgs);
        msgs = basicSetImports(newImports, msgs);
        if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, MelangePackage.MODEL_TYPING_SPACE__IMPORTS, newImports, newImports));
}
项目:XRobot    文件:ProgramImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetImports(XImportSection newImports, NotificationChain msgs)
{
  XImportSection oldImports = imports;
  imports = newImports;
  if (eNotificationRequired())
  {
    ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XRobotDSLPackage.PROGRAM__IMPORTS, oldImports, newImports);
    if (msgs == null) msgs = notification; else msgs.add(notification);
  }
  return msgs;
}
项目:XRobot    文件:ProgramImpl.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case XRobotDSLPackage.PROGRAM__IMPORTS:
      setImports((XImportSection)newValue);
      return;
    case XRobotDSLPackage.PROGRAM__NAME:
      setName((String)newValue);
      return;
    case XRobotDSLPackage.PROGRAM__AUTHOR:
      setAuthor((String)newValue);
      return;
    case XRobotDSLPackage.PROGRAM__FUNCTIONS:
      getFunctions().clear();
      getFunctions().addAll((Collection<? extends Function>)newValue);
      return;
    case XRobotDSLPackage.PROGRAM__VARIABLES:
      getVariables().clear();
      getVariables().addAll((Collection<? extends Variable>)newValue);
      return;
    case XRobotDSLPackage.PROGRAM__MODES:
      getModes().clear();
      getModes().addAll((Collection<? extends Mode>)newValue);
      return;
  }
  super.eSet(featureID, newValue);
}