org.eclipse.xtext.xbase.lib.CollectionExtensions Java Examples

The following examples show how to use org.eclipse.xtext.xbase.lib.CollectionExtensions. 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: ImplicitlyImportedFeatures.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected List<Class<?>> getExtensionClasses() {
	return Lists.<Class<?>> newArrayList(
		ArrayExtensions.class,
		BigDecimalExtensions.class,
		BigIntegerExtensions.class,
		BooleanExtensions.class,
		ByteExtensions.class,
		CharacterExtensions.class,
		CollectionExtensions.class,
		ComparableExtensions.class,
		DoubleExtensions.class,
		FloatExtensions.class,
		FunctionExtensions.class,
		IntegerExtensions.class,
		IterableExtensions.class,
		IteratorExtensions.class,
		ListExtensions.class,
		LongExtensions.class,
		MapExtensions.class,
		ObjectExtensions.class,
		ProcedureExtensions.class,
		ShortExtensions.class,
		StringExtensions.class);
}
 
Example #2
Source File: FragmentAdapter.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
private void generateManifestRt(final LanguageConfig config1, final XpandExecutionContext ctx) {
  ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    final String[] exported = this.fragment.getExportedPackagesRt(config1.getGrammar());
    if ((exported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getExportedPackages(), exported);
    }
    final String[] required = this.fragment.getRequiredBundlesRt(config1.getGrammar());
    if ((required != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(), required);
    }
    final String[] imported = this.fragment.getImportedPackagesRt(config1.getGrammar());
    if ((imported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getImportedPackages(), imported);
    }
  }
}
 
Example #3
Source File: FragmentAdapter.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
private void generateManifestUi(final LanguageConfig config1, final XpandExecutionContext ctx) {
  ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    final String[] exported = this.fragment.getExportedPackagesUi(config1.getGrammar());
    if ((exported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages(), exported);
    }
    final String[] required = this.fragment.getRequiredBundlesUi(config1.getGrammar());
    if ((required != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(), required);
    }
    final String[] imported = this.fragment.getImportedPackagesUi(config1.getGrammar());
    if ((imported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getEclipsePlugin().getManifest().getImportedPackages(), imported);
    }
  }
}
 
Example #4
Source File: FragmentAdapter.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
private void generateManifestIde(final LanguageConfig config1, final XpandExecutionContext ctx) {
  if (((this.fragment instanceof IGeneratorFragmentExtension3) && (this.getProjectConfig().getGenericIde().getManifest() != null))) {
    final IGeneratorFragmentExtension3 fr = ((IGeneratorFragmentExtension3) this.fragment);
    final String[] exported = fr.getExportedPackagesIde(config1.getGrammar());
    if ((exported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getGenericIde().getManifest().getExportedPackages(), exported);
    }
    final String[] required = fr.getRequiredBundlesIde(config1.getGrammar());
    if ((required != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getGenericIde().getManifest().getRequiredBundles(), required);
    }
    final String[] imported = fr.getImportedPackagesIde(config1.getGrammar());
    if ((imported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getGenericIde().getManifest().getImportedPackages(), imported);
    }
  }
}
 
Example #5
Source File: FragmentAdapter.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
private void generateManifestTests(final LanguageConfig config1, final XpandExecutionContext ctx) {
  if (((this.fragment instanceof IGeneratorFragmentExtension) && (this.getProjectConfig().getRuntimeTest().getManifest() != null))) {
    final IGeneratorFragmentExtension fr = ((IGeneratorFragmentExtension) this.fragment);
    final String[] exported = fr.getExportedPackagesTests(config1.getGrammar());
    if ((exported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntimeTest().getManifest().getExportedPackages(), exported);
    }
    final String[] required = fr.getRequiredBundlesTests(config1.getGrammar());
    if ((required != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntimeTest().getManifest().getRequiredBundles(), required);
    }
    final String[] imported = fr.getImportedPackagesTests(config1.getGrammar());
    if ((imported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntimeTest().getManifest().getImportedPackages(), imported);
    }
  }
}
 
Example #6
Source File: NestedTypesScope.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Iterable<IEObjectDescription> getLocalElementsByName(QualifiedName name) {
	List<JvmDeclaredType> nestedTypeDeclarators = session.getNestedTypeDeclarators();
	if (nestedTypeDeclarators.isEmpty())
		return Collections.emptyList();
	Iterator<JvmDeclaredType> iterator = nestedTypeDeclarators.iterator();
	String simpleName = name.getFirstSegment();
	List<IEObjectDescription> result = null;
	if (name.getSegmentCount() == 1) {
		Set<JvmDeclaredType> nestedTypesSet = new LinkedHashSet<>();
		while(iterator.hasNext()) {
			JvmDeclaredType declarator = iterator.next();
			Iterable<JvmDeclaredType> nestedTypes = declarator.findAllNestedTypesByName(simpleName);
			CollectionExtensions.addAll(nestedTypesSet, nestedTypes);
		}
		if (!nestedTypesSet.isEmpty()) {
			result = addDescriptions(name, 0, nestedTypesSet, result);
		}
	}
	if (result == null && name.getSegmentCount() == 1 && simpleName.indexOf('$') > 0) {
		QualifiedName splitted = QualifiedName.create(Strings.split(simpleName, '$'));
		return getLocalElementsByName(splitted);
	}
	if (result != null)
		return result;
	return Collections.emptyList();
}
 
Example #7
Source File: StaticImplicitMethodsFeatureForTypeProvider.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected Multimap<Class<?>, Class<?>> simpleComputeExtensionClasses() {
	Multimap<Class<?>, Class<?>> result = ArrayListMultimap.create();
	result.put(String.class, StringExtensions.class);
	result.put(Double.TYPE, DoubleExtensions.class);
	result.put(Float.TYPE, FloatExtensions.class);
	result.put(Long.TYPE, LongExtensions.class);
	result.put(Integer.TYPE, IntegerExtensions.class);
	result.put(Character.TYPE, CharacterExtensions.class);
	result.put(Short.TYPE, ShortExtensions.class);
	result.put(Byte.TYPE, ByteExtensions.class);
	result.put(Boolean.TYPE, BooleanExtensions.class);
	result.put(double[].class, ArrayExtensions.class);
	result.put(float[].class, ArrayExtensions.class);
	result.put(long[].class, ArrayExtensions.class);
	result.put(int[].class, ArrayExtensions.class);
	result.put(char[].class, ArrayExtensions.class);
	result.put(short[].class, ArrayExtensions.class);
	result.put(byte[].class, ArrayExtensions.class);
	result.put(boolean[].class, ArrayExtensions.class);
	result.put(BigInteger.class, BigIntegerExtensions.class);
	result.put(BigDecimal.class, BigDecimalExtensions.class);
	result.put(Comparable.class, ComparableExtensions.class);
	result.put(Object.class, ObjectExtensions.class);
	result.put(List.class, ListExtensions.class);
	result.put(Collection.class, CollectionExtensions.class);
	result.put(Map.class, CollectionExtensions.class);
	result.put(Map.class, MapExtensions.class);
	result.put(Iterable.class, IterableExtensions.class);
	result.put(Iterator.class, IteratorExtensions.class);
	result.put(Functions.Function0.class, FunctionExtensions.class);
	result.put(Functions.Function1.class, FunctionExtensions.class);
	result.put(Functions.Function2.class, FunctionExtensions.class);
	result.put(Functions.Function3.class, FunctionExtensions.class);
	result.put(Functions.Function4.class, FunctionExtensions.class);
	result.put(Functions.Function5.class, FunctionExtensions.class);
	result.put(Functions.Function6.class, FunctionExtensions.class);
	result.put(Procedures.Procedure0.class, ProcedureExtensions.class);
	result.put(Procedures.Procedure1.class, ProcedureExtensions.class);
	result.put(Procedures.Procedure2.class, ProcedureExtensions.class);
	result.put(Procedures.Procedure3.class, ProcedureExtensions.class);
	result.put(Procedures.Procedure4.class, ProcedureExtensions.class);
	result.put(Procedures.Procedure5.class, ProcedureExtensions.class);
	result.put(Procedures.Procedure6.class, ProcedureExtensions.class);
	return result;
}