org.eclipse.xtext.xtype.XImportSection Java Examples

The following examples show how to use org.eclipse.xtext.xtype.XImportSection. 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: DomainModelImpl.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setImportSection(XImportSection newImportSection)
{
  if (newImportSection != importSection)
  {
    NotificationChain msgs = null;
    if (importSection != null)
      msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DomainmodelPackage.DOMAIN_MODEL__IMPORT_SECTION, null, msgs);
    if (newImportSection != null)
      msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DomainmodelPackage.DOMAIN_MODEL__IMPORT_SECTION, null, msgs);
    msgs = basicSetImportSection(newImportSection, msgs);
    if (msgs != null) msgs.dispatch();
  }
  else if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET, DomainmodelPackage.DOMAIN_MODEL__IMPORT_SECTION, newImportSection, newImportSection));
}
 
Example #2
Source File: ClasspathBasedIdeTypesProposalProvider.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected ContentAssistEntry createProposal(EReference reference, ITypeDescriptor typeDesc,
		ContentAssistContext context, XImportSection importSection, ITextRegion importSectionRegion) {
	boolean importDecl = isImportDeclaration(reference, context);
	String qualifiedName = qualifiedNameConverter.toString(typeDesc.getQualifiedName());
	String proposal;
	if (importDecl) {
		proposal = qualifiedName;
	} else {
		proposal = typeDesc.getSimpleName();
	}
	return proposalCreator.createProposal(proposal, context, (ContentAssistEntry it) -> {
		it.setKind(ContentAssistEntry.KIND_REFERENCE);
		if (importDecl) {
			it.setLabel(typeDesc.getSimpleName());
			it.setDescription(proposal);
		} else {
			it.setDescription(qualifiedName);
			if (importSectionRegion != null
					&& isImportDeclarationRequired(typeDesc, qualifiedName, context, importSection)) {
				addImportDeclaration(it, importSectionRegion, typeDesc, qualifiedName, context);
			}
		}
	});
}
 
Example #3
Source File: ClasspathBasedIdeTypesProposalProvider.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createTypeProposals(EReference reference, ContentAssistContext context,
		Predicate<? super ITypeDescriptor> filter, IIdeContentProposalAcceptor acceptor) {
	ITextRegion importSectionRegion = null;
	XImportSection importSection = null;
	if (!isImportDeclaration(reference, context)) {
		importSection = importsConfiguration.getImportSection(context.getResource());
		importSectionRegion = importSectionRegionUtil.computeRegion(context.getResource());
	}
	for (ITypeDescriptor typeDesc : getTypeDescriptors(context)) {
		if (!acceptor.canAcceptMoreProposals()) {
			return;
		}
		if (canPropose(typeDesc, context, filter)) {
			ContentAssistEntry entry = createProposal(reference, typeDesc, context, importSection,
					importSectionRegion);
			int priority = ((XbaseIdeContentProposalPriorities) proposalPriorities).getTypeRefPriority(typeDesc,
					entry);
			acceptor.accept(entry, priority);
		}
	}
}
 
Example #4
Source File: ImportSectionTestLanguageRootImpl.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
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));
}
 
Example #5
Source File: XtendFileImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setImportSection(XImportSection newImportSection)
{
	if (newImportSection != importSection)
	{
		NotificationChain msgs = null;
		if (importSection != null)
			msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtendPackage.XTEND_FILE__IMPORT_SECTION, null, msgs);
		if (newImportSection != null)
			msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtendPackage.XTEND_FILE__IMPORT_SECTION, null, msgs);
		msgs = basicSetImportSection(newImportSection, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XtendPackage.XTEND_FILE__IMPORT_SECTION, newImportSection, newImportSection));
}
 
Example #6
Source File: XtendFileImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
	switch (featureID)
	{
		case XtendPackage.XTEND_FILE__IMPORT_SECTION:
			setImportSection((XImportSection)newValue);
			return;
		case XtendPackage.XTEND_FILE__XTEND_TYPES:
			getXtendTypes().clear();
			getXtendTypes().addAll((Collection<? extends XtendTypeDeclaration>)newValue);
			return;
		case XtendPackage.XTEND_FILE__PACKAGE:
			setPackage((String)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
Example #7
Source File: RewritableImportSection.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
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 #8
Source File: RewritableImportSection.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
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);
			}
		}
	}
}
 
Example #9
Source File: JavaTypeQuickfixes.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected void parseImportSection(XImportSection importSection, IAcceptor<String> visiblePackages,
		IAcceptor<String> importedTypes) {
	for (XImportDeclaration importDeclaration : importSection.getImportDeclarations()) {
		if (!importDeclaration.isStatic()) {
			if (importDeclaration.getImportedNamespace() != null) {
				String importedAsString = importDeclaration.getImportedNamespace();
				if (importDeclaration.isWildcard()) {
					importedAsString = importedAsString.substring(0, importedAsString.length() - 2);
					visiblePackages.accept(importedAsString);
				} else {
					importedTypes.accept(importedAsString);
				}
			} else {
				importedTypes.accept(importDeclaration.getImportedTypeName());
			}
		}
	}
}
 
Example #10
Source File: XbaseValidator.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
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);
					}
				}
			}
		}
	}
}
 
Example #11
Source File: XtendFileImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
	switch (featureID)
	{
		case XtendPackage.XTEND_FILE__IMPORT_SECTION:
			setImportSection((XImportSection)null);
			return;
		case XtendPackage.XTEND_FILE__XTEND_TYPES:
			getXtendTypes().clear();
			return;
		case XtendPackage.XTEND_FILE__PACKAGE:
			setPackage(PACKAGE_EDEFAULT);
			return;
	}
	super.eUnset(featureID);
}
 
Example #12
Source File: EntitiesImpl.java    From xtext-web with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case DomainmodelPackage.ENTITIES__IMPORT_SECTION:
      setImportSection((XImportSection)newValue);
      return;
    case DomainmodelPackage.ENTITIES__ELEMENTS:
      getElements().clear();
      getElements().addAll((Collection<? extends AbstractElement>)newValue);
      return;
  }
  super.eSet(featureID, newValue);
}
 
Example #13
Source File: EntitiesImpl.java    From xtext-web with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setImportSection(XImportSection newImportSection)
{
  if (newImportSection != importSection)
  {
    NotificationChain msgs = null;
    if (importSection != null)
      msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DomainmodelPackage.ENTITIES__IMPORT_SECTION, null, msgs);
    if (newImportSection != null)
      msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DomainmodelPackage.ENTITIES__IMPORT_SECTION, null, msgs);
    msgs = basicSetImportSection(newImportSection, msgs);
    if (msgs != null) msgs.dispatch();
  }
  else if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET, DomainmodelPackage.ENTITIES__IMPORT_SECTION, newImportSection, newImportSection));
}
 
Example #14
Source File: CheckCatalogImpl.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * <!-- 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));
}
 
Example #15
Source File: ModelImpl.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
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));
}
 
Example #16
Source File: ModelImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- 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;
}
 
Example #17
Source File: XImportSectionNamespaceScopeProvider.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
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;
}
 
Example #18
Source File: XtendImportsConfiguration.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setImportSection(XtextResource resource, XImportSection importSection) {
	XtendFile xtendFile = getXtendFile(resource);
	if (xtendFile != null) {
		xtendFile.setImportSection(importSection);
	}
}
 
Example #19
Source File: ScriptBuilderImpl.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** 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 #20
Source File: DomainModelImpl.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- 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, DomainmodelPackage.DOMAIN_MODEL__IMPORT_SECTION, oldImportSection, newImportSection);
    if (msgs == null) msgs = notification; else msgs.add(notification);
  }
  return msgs;
}
 
Example #21
Source File: XtendImportsConfiguration.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public XImportSection getImportSection(XtextResource resource) {
	XtendFile xtendFile = getXtendFile(resource);
	if(xtendFile != null)
		return xtendFile.getImportSection();
	else
		return null;
}
 
Example #22
Source File: ImportSectionTestLanguageRootImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- 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;
}
 
Example #23
Source File: DomainModelImpl.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
  switch (featureID)
  {
    case DomainmodelPackage.DOMAIN_MODEL__IMPORT_SECTION:
      setImportSection((XImportSection)null);
      return;
    case DomainmodelPackage.DOMAIN_MODEL__ELEMENTS:
      getElements().clear();
      return;
  }
  super.eUnset(featureID);
}
 
Example #24
Source File: ImportSectionTestLanguageRootImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- 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);
}
 
Example #25
Source File: ImportSectionTestLanguageRootImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- 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);
}
 
Example #26
Source File: XbaseLabelProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @return the {@code ImageDescriptor} for a given {@code obj}
 * @throws NullPointerException
 *             if the passed {@code obj} is null
 */
protected ImageDescriptor imageDescriptor(Object obj) {
	Preconditions.checkNotNull(obj);

	if (obj instanceof JvmConstructor) {
		return _imageDescriptor((JvmConstructor) obj);
	} else if (obj instanceof JvmOperation) {
		return _imageDescriptor((JvmOperation) obj);
	} else if (obj instanceof JvmAnnotationType) {
		return _imageDescriptor((JvmAnnotationType) obj);
	} else if (obj instanceof JvmEnumerationType) {
		return _imageDescriptor((JvmEnumerationType) obj);
	} else if (obj instanceof JvmField) {
		return _imageDescriptor((JvmField) obj);
	} else if (obj instanceof JvmGenericType) {
		return _imageDescriptor((JvmGenericType) obj);
	} else if (obj instanceof JvmTypeParameter) {
		return _imageDescriptor((JvmTypeParameter) obj);
	} else if (obj instanceof JvmFormalParameter) {
		return _imageDescriptor((JvmFormalParameter) obj);
	} else if (obj instanceof XVariableDeclaration) {
		return _imageDescriptor((XVariableDeclaration) obj);
	} else if (obj instanceof IResolvedConstructor) {
		return _imageDescriptor((IResolvedConstructor) obj);
	} else if (obj instanceof IResolvedOperation) {
		return _imageDescriptor((IResolvedOperation) obj);
	} else if (obj instanceof XImportDeclaration) {
		return _imageDescriptor((XImportDeclaration) obj);
	} else if (obj instanceof XImportSection) {
		return _imageDescriptor((XImportSection) obj);
	} else if (obj instanceof IResolvedField) {
		return _imageDescriptor((IResolvedField) obj);
	}
	return _imageDescriptor(obj);
}
 
Example #27
Source File: DomainmodelLabelProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Object doGetImage(Object element) {
	if (element instanceof JvmIdentifiableElement || element instanceof XImportSection || element instanceof XImportDeclaration) {
		return super.doGetImage(element);
	} else if (element instanceof EObject) {
		return ((EObject) element).eClass().getName() + ".gif";
	}
	return super.doGetImage(element);

}
 
Example #28
Source File: EntitiesImpl.java    From xtext-web with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
  switch (featureID)
  {
    case DomainmodelPackage.ENTITIES__IMPORT_SECTION:
      setImportSection((XImportSection)null);
      return;
    case DomainmodelPackage.ENTITIES__ELEMENTS:
      getElements().clear();
      return;
  }
  super.eUnset(featureID);
}
 
Example #29
Source File: ImportingTypesProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected IReplacementTextApplier createTextApplier(ContentAssistContext context, IScope typeScope,
		IQualifiedNameConverter qualifiedNameConverter, IValueConverter<String> valueConverter) {
	if (EcoreUtil2.getContainerOfType(context.getCurrentModel(), XImportSection.class) != null)
		return null;
	return new FQNImporter(context.getResource(), context.getViewer(), typeScope, qualifiedNameConverter,
			valueConverter, importSectionFactory, replaceConverter);
}
 
Example #30
Source File: EntitiesImpl.java    From xtext-web with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- 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, DomainmodelPackage.ENTITIES__IMPORT_SECTION, oldImportSection, newImportSection);
    if (msgs == null) msgs = notification; else msgs.add(notification);
  }
  return msgs;
}