Java Code Examples for org.eclipse.xtext.xbase.lib.CollectionLiterals#newLinkedHashSet()

The following examples show how to use org.eclipse.xtext.xbase.lib.CollectionLiterals#newLinkedHashSet() . 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: JdtBasedProcessorProvider.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Construct a Classloader with the classpathentries from the provided and all upstream-projects,
 * except the output folders of the local project.
 */
protected URLClassLoader createClassLoaderForJavaProject(final IJavaProject projectToUse) {
  final LinkedHashSet<URL> urls = CollectionLiterals.<URL>newLinkedHashSet();
  try {
    this.collectClasspathURLs(projectToUse, urls, this.isOutputFolderIncluded(), CollectionLiterals.<IJavaProject>newHashSet());
  } catch (final Throwable _t) {
    if (_t instanceof JavaModelException) {
      final JavaModelException e = (JavaModelException)_t;
      boolean _isDoesNotExist = e.isDoesNotExist();
      boolean _not = (!_isDoesNotExist);
      if (_not) {
        JdtBasedProcessorProvider.LOG.error(e.getMessage(), e);
      }
    } else {
      throw Exceptions.sneakyThrow(_t);
    }
  }
  ClassLoader _parentClassLoader = this.getParentClassLoader();
  return new URLClassLoader(((URL[])Conversions.unwrapArray(urls, URL.class)), _parentClassLoader);
}
 
Example 2
Source File: RuntimeProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Set<String> getDevelopmentBundles() {
  final LinkedHashSet<String> result = CollectionLiterals.<String>newLinkedHashSet(
    "org.eclipse.xtext.xbase", 
    "org.eclipse.xtext.common.types", 
    "org.eclipse.xtext.xtext.generator", 
    "org.eclipse.emf.codegen.ecore", 
    "org.eclipse.emf.mwe.utils", 
    "org.eclipse.emf.mwe2.launch", 
    "org.eclipse.emf.mwe2.lib", 
    "org.objectweb.asm", 
    "org.apache.commons.logging", 
    "org.apache.log4j");
  boolean _isFromExistingEcoreModels = this.isFromExistingEcoreModels();
  if (_isFromExistingEcoreModels) {
    final Function1<EPackageInfo, Boolean> _function = (EPackageInfo it) -> {
      String _fileExtension = it.getGenmodelURI().fileExtension();
      return Boolean.valueOf(Objects.equal(_fileExtension, "xcore"));
    };
    boolean _exists = IterableExtensions.<EPackageInfo>exists(this.getConfig().getEcore2Xtext().getEPackageInfos(), _function);
    if (_exists) {
      result.add("org.eclipse.emf.ecore.xcore");
    }
  }
  return result;
}
 
Example 3
Source File: TestedProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Set<ExternalDependency> getExternalDependencies() {
  LinkedHashSet<ExternalDependency> _xblockexpression = null;
  {
    final LinkedHashSet<ExternalDependency> deps = CollectionLiterals.<ExternalDependency>newLinkedHashSet();
    Set<ExternalDependency> _externalDependencies = super.getExternalDependencies();
    Iterables.<ExternalDependency>addAll(deps, _externalDependencies);
    boolean _isInlined = this.getTestProject().isInlined();
    if (_isInlined) {
      Set<ExternalDependency> _externalDependencies_1 = this.getTestProject().getExternalDependencies();
      Iterables.<ExternalDependency>addAll(deps, _externalDependencies_1);
    }
    _xblockexpression = deps;
  }
  return _xblockexpression;
}
 
Example 4
Source File: TestedProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Set<SourceFolderDescriptor> getSourceFolders() {
  LinkedHashSet<SourceFolderDescriptor> _xblockexpression = null;
  {
    final LinkedHashSet<SourceFolderDescriptor> sourceFolders = CollectionLiterals.<SourceFolderDescriptor>newLinkedHashSet();
    Set<SourceFolderDescriptor> _sourceFolders = super.getSourceFolders();
    Iterables.<SourceFolderDescriptor>addAll(sourceFolders, _sourceFolders);
    boolean _isInlined = this.getTestProject().isInlined();
    if (_isInlined) {
      Set<SourceFolderDescriptor> _sourceFolders_1 = this.getTestProject().getSourceFolders();
      Iterables.<SourceFolderDescriptor>addAll(sourceFolders, _sourceFolders_1);
    }
    _xblockexpression = sourceFolders;
  }
  return _xblockexpression;
}
 
Example 5
Source File: DelegateProcessor.java    From xtext-lib with Eclipse Public License 2.0 5 votes vote down vote up
public Set<TypeReference> getImplementedInterfaces(final TypeReference it) {
  Set<TypeReference> _xblockexpression = null;
  {
    final LinkedHashSet<TypeReference> seen = CollectionLiterals.<TypeReference>newLinkedHashSet();
    this.collectAllSuperTypes(it, seen);
    final Function1<TypeReference, Boolean> _function = (TypeReference it_1) -> {
      Type _type = it_1.getType();
      return Boolean.valueOf((_type instanceof InterfaceDeclaration));
    };
    _xblockexpression = IterableExtensions.<TypeReference>toSet(IterableExtensions.<TypeReference>filter(seen, _function));
  }
  return _xblockexpression;
}
 
Example 6
Source File: XtendAntlrGrammarGeneratorHelper.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public LinkedHashSet<String> getTokens(final Grammar it) {
  final LinkedHashSet<String> tokens = CollectionLiterals.<String>newLinkedHashSet();
  List<ParserRule> _allParserRules = GrammarUtil.allParserRules(it);
  List<EnumRule> _allEnumRules = GrammarUtil.allEnumRules(it);
  Iterable<AbstractRule> _plus = Iterables.<AbstractRule>concat(_allParserRules, _allEnumRules);
  for (final AbstractRule rule : _plus) {
    this.collectTokens(rule, tokens);
  }
  return tokens;
}
 
Example 7
Source File: ConstantExpressionsInterpreter.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public Object evaluate(final XExpression expression, final JvmTypeReference expectedType) {
  final ClassLoader classLoader = this.classLoaderProvider.getClassLoader(expression);
  final Map<String, JvmIdentifiableElement> visibleFeatures = this.findVisibleFeatures(expression);
  JvmTypeReference _xifexpression = null;
  if ((expectedType instanceof XComputedTypeReference)) {
    _xifexpression = null;
  } else {
    _xifexpression = expectedType;
  }
  ClassFinder _classFinder = new ClassFinder(classLoader);
  LinkedHashSet<XExpression> _newLinkedHashSet = CollectionLiterals.<XExpression>newLinkedHashSet();
  Context _context = new Context(_xifexpression, _classFinder, visibleFeatures, _newLinkedHashSet);
  final Object result = this.evaluate(expression, _context);
  return result;
}
 
Example 8
Source File: SyntacticSequencerExtensions.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public Set<ISyntacticSequencerPDAProvider.ISynTransition> getAllAmbiguousTransitions() {
  final Set<ISyntacticSequencerPDAProvider.ISynTransition> result = CollectionLiterals.<ISyntacticSequencerPDAProvider.ISynTransition>newLinkedHashSet();
  List<ISyntacticSequencerPDAProvider.ISynAbsorberState> _allPDAs = this.getAllPDAs();
  for (final ISyntacticSequencerPDAProvider.ISynAbsorberState start : _allPDAs) {
    this.collectAllAmbiguousTransitions(start, result, CollectionLiterals.<Object>newHashSet());
  }
  return result;
}
 
Example 9
Source File: IdeProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Set<ExternalDependency> getExternalDependencies() {
  LinkedHashSet<ExternalDependency> _xblockexpression = null;
  {
    final LinkedHashSet<ExternalDependency> deps = CollectionLiterals.<ExternalDependency>newLinkedHashSet();
    Set<ExternalDependency> _externalDependencies = super.getExternalDependencies();
    Iterables.<ExternalDependency>addAll(deps, _externalDependencies);
    ExternalDependency _createXtextDependency = ExternalDependency.createXtextDependency("org.eclipse.xtext.ide");
    deps.add(_createXtextDependency);
    ExternalDependency _createXtextDependency_1 = ExternalDependency.createXtextDependency("org.eclipse.xtext.xbase.ide");
    deps.add(_createXtextDependency_1);
    _xblockexpression = deps;
  }
  return _xblockexpression;
}
 
Example 10
Source File: UiProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Set<String> getBinIncludes() {
  LinkedHashSet<String> _xblockexpression = null;
  {
    final LinkedHashSet<String> includes = CollectionLiterals.<String>newLinkedHashSet();
    Set<String> _binIncludes = super.getBinIncludes();
    Iterables.<String>addAll(includes, _binIncludes);
    includes.add("plugin.xml");
    _xblockexpression = includes;
  }
  return _xblockexpression;
}
 
Example 11
Source File: ProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public Set<String> getBinIncludes() {
  StringConcatenation _builder = new StringConcatenation();
  String _sourceFolder = this.sourceFolder(Outlet.META_INF);
  _builder.append(_sourceFolder);
  _builder.append("/");
  return CollectionLiterals.<String>newLinkedHashSet(".", _builder.toString());
}
 
Example 12
Source File: ProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public Set<ExternalDependency> getExternalDependencies() {
  final LinkedHashSet<ExternalDependency> deps = CollectionLiterals.<ExternalDependency>newLinkedHashSet();
  Set<EPackageInfo> _ePackageInfos = this.config.getEcore2Xtext().getEPackageInfos();
  for (final EPackageInfo ePackage : _ePackageInfos) {
    ExternalDependency _createBundleDependency = ExternalDependency.createBundleDependency(ePackage.getBundleID());
    deps.add(_createBundleDependency);
  }
  return deps;
}
 
Example 13
Source File: RuntimeProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Set<String> getBinIncludes() {
  LinkedHashSet<String> _xblockexpression = null;
  {
    final LinkedHashSet<String> includes = CollectionLiterals.<String>newLinkedHashSet();
    Set<String> _binIncludes = super.getBinIncludes();
    Iterables.<String>addAll(includes, _binIncludes);
    if (this.withPluginXml) {
      includes.add("plugin.xml");
    }
    _xblockexpression = includes;
  }
  return _xblockexpression;
}
 
Example 14
Source File: ProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.11
 */
public Set<String> getBinExcludes() {
  return CollectionLiterals.<String>newLinkedHashSet("**/*.xtend");
}
 
Example 15
Source File: WebProjectDescriptor.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Set<? extends ProjectDescriptor> getUpstreamProjects() {
  return CollectionLiterals.<ProjectDescriptor>newLinkedHashSet(this.getConfig().getRuntimeProject(), this.getConfig().getIdeProject());
}