Tabnine Logo
IManifoldHost
Code IndexAdd Tabnine to your IDE (free)

How to use
IManifoldHost
in
manifold.api.host

Best Java code snippets using manifold.api.host.IManifoldHost (Showing top 20 results out of 315)

origin: manifold-systems/manifold

default IFileSystem getFileSystem()
{
 return getHost().getFileSystem();
}
origin: manifold-systems/manifold

private static URI getUriFrom( IManifoldHost host, String fqn )
{
 final String outRelativePath = fqn.replace( '.', File.separatorChar ) + ".class";
 IDirectory outputPath = host.getSingleModule().getOutputPath().stream().findFirst().orElse( null );
 File file = new File( outputPath.getPath().getFileSystemPathString(), outRelativePath );
 return file.toURI();
}
origin: manifold-systems/manifold

public TypeSystemAwareCache( IManifoldHost host, String name, int size, Loader<K, V> loader )
{
 super( name, size, loader );
 host.addTypeSystemListenerAsWeakRef( null, _cacheClearer );
}
origin: manifold-systems/manifold

private String getTypeForFile( JavaFileObject file )
{
 URI uri = file.toUri();
 if( !uri.getScheme().equalsIgnoreCase( "file" ) )
 {
  return makeTypeName( file.getName() );
 }
 IFile iFile = getHost().getFileSystem().getIFile( new File( file.getName() ) );
 List<IDirectory> sourcePath = getHost().getSingleModule().getSourcePath();
 for( IDirectory dir : sourcePath )
 {
  if( iFile.isDescendantOf( dir ) )
  {
   return makeTypeName( iFile.getName().substring( dir.getName().length() ) );
  }
 }
 throw new IllegalStateException( "Could not infer type name from: " + file.getName() );
}
origin: manifold-systems/manifold

private JCTree.JCClassDecl getClassDecl( Model model )
{
 JCTree.JCClassDecl classDecl = model.getClassDecl();
 if( classDecl != null )
 {
  return classDecl;
 }
 List<CompilationUnitTree> trees = new ArrayList<>();
 getModule().getHost().getJavaParser().parseText( getSource( model ), trees, null, null, null );
 if( trees.isEmpty() )
 {
  return null;
 }
 classDecl = (JCTree.JCClassDecl)trees.get( 0 ).getTypeDecls().get( 0 );
 model.setClassDecl( classDecl );
 return classDecl;
}
origin: systems.manifold/manifold-ext

private boolean isInnerToJavaClass( String topLevel, String relativeInner )
{
 try
 {
  Class<?> cls = Class.forName( topLevel, false, getModule().getHost().getActualClassLoader() );
  for( Class<?> inner : cls.getDeclaredClasses() )
  {
   if( isInnerClass( inner, relativeInner ) )
   {
    return true;
   }
  }
 }
 catch( ClassNotFoundException ignore )
 {
 }
 return false;
}
origin: manifold-systems/manifold

private void addFilesInDir( String relativePath, IDirectory dir, Map<String, FqnCache<IFile>> filesByExtension )
{
 if( !_module.getHost().isPathIgnored( relativePath ) )
 {
  for( IFile file : dir.listFiles() )
  {
   String simpleName = file.getName();
   int iDot = simpleName.lastIndexOf( '.' );
   if( iDot > 0 )
   {
    simpleName = simpleName.substring( 0, iDot );
   }
   String fqn = appendResourceNameToPath( relativePath, simpleName );
   addToExtension( fqn, file, filesByExtension );
   addToReverseMap( file, fqn );
  }
  for( IDirectory subdir : dir.listDirs() )
  {
   if( isValidPackage( subdir ) )
   {
    String fqn = appendResourceNameToPath( relativePath, subdir.getName() );
    addFilesInDir( fqn, subdir, filesByExtension );
   }
  }
 }
}
origin: manifold-systems/manifold

Set<IFile> changes = changedFiles.stream().map( ( File f ) -> host.getFileSystem().getIFile( f ) )
 .collect( Collectors.toSet() );
for( ITypeManifold tm: host.getSingleModule().getTypeManifolds() )
origin: systems.manifold/manifold-darkj

private JCTree.JCClassDecl getClassDecl( Model model )
{
 JCTree.JCClassDecl classDecl = model.getClassDecl();
 if( classDecl != null )
 {
  return classDecl;
 }
 List<CompilationUnitTree> trees = new ArrayList<>();
 getModule().getHost().getJavaParser().parseText( getSource( model ), trees, null, null, null );
 if( trees.isEmpty() )
 {
  return null;
 }
 classDecl = (JCTree.JCClassDecl)trees.get( 0 ).getTypeDecls().get( 0 );
 model.setClassDecl( classDecl );
 return classDecl;
}
origin: manifold-systems/manifold

private boolean isInnerToJavaClass( String topLevel, String relativeInner )
{
 try
 {
  Class<?> cls = Class.forName( topLevel, false, getModule().getHost().getActualClassLoader() );
  for( Class<?> inner : cls.getDeclaredClasses() )
  {
   if( isInnerClass( inner, relativeInner ) )
   {
    return true;
   }
  }
 }
 catch( ClassNotFoundException ignore )
 {
 }
 return false;
}
origin: systems.manifold/manifold-ext

Set<IFile> changes = changedFiles.stream().map( ( File f ) -> host.getFileSystem().getIFile( f ) )
 .collect( Collectors.toSet() );
for( ITypeManifold tm: host.getSingleModule().getTypeManifolds() )
origin: systems.manifold/manifold-ext

private SrcClass makeStubFromSource()
{
 List<CompilationUnitTree> trees = new ArrayList<>();
 _model.getHost().getJavaParser().parseText( _existingSource, trees, null, null, null );
 JCTree.JCClassDecl classDecl = (JCTree.JCClassDecl)trees.get( 0 ).getTypeDecls().get( 0 );
 SrcClass srcExtended = new SrcClass( _fqn, classDecl.getKind() == Tree.Kind.CLASS ? SrcClass.Kind.Class : SrcClass.Kind.Interface )
  .modifiers( classDecl.getModifiers().getFlags() );
 if( classDecl.extending != null )
 {
  srcExtended.superClass( classDecl.extending.toString() );
 }
 for( JCTree.JCExpression iface : classDecl.implementing )
 {
  srcExtended.addInterface( iface.toString() );
 }
 return srcExtended;
}
origin: manifold-systems/manifold

private static URI getUriFrom( IManifoldHost host, String fqn, String filename )
{
 final String outRelativePath = fqn.replace( '.', File.separatorChar ) + File.separatorChar + filename;
 IDirectory outputPath = host.getSingleModule().getOutputPath().stream().findFirst().orElse( null );
 File file = new File( outputPath.getPath().getFileSystemPathString(), outRelativePath );
 return file.toURI();
}
origin: manifold-systems/manifold

protected IDirectory getIResourceFromJavaFile( URL location )
{
 return getHost().getFileSystem().getIDirectory( getFileFromURL( location ) );
}
origin: manifold-systems/manifold

public PathCache( IModule module, Supplier<Collection<IDirectory>> pathSupplier, Runnable clearHandler )
{
 _module = module;
 _pathSupplier = pathSupplier;
 _clearHandler = clearHandler;
 _reverseMap = new ConcurrentHashMap<>();
 init();
 _module.getHost().addTypeSystemListenerAsWeakRef( module, _clearer = new CacheClearer() );
}
origin: manifold-systems/manifold

private SrcClass makeStubFromSource()
{
 List<CompilationUnitTree> trees = new ArrayList<>();
 _model.getHost().getJavaParser().parseText( _existingSource, trees, null, null, null );
 JCTree.JCClassDecl classDecl = (JCTree.JCClassDecl)trees.get( 0 ).getTypeDecls().get( 0 );
 SrcClass srcExtended = new SrcClass( _fqn, classDecl.getKind() == Tree.Kind.CLASS ? SrcClass.Kind.Class : SrcClass.Kind.Interface )
  .modifiers( classDecl.getModifiers().getFlags() );
 if( classDecl.extending != null )
 {
  srcExtended.superClass( classDecl.extending.toString() );
 }
 for( JCTree.JCExpression iface : classDecl.implementing )
 {
  srcExtended.addInterface( iface.toString() );
 }
 return srcExtended;
}
origin: systems.manifold/manifold-ext

private void addToPrecompile( Map<String, Set<String>> typeNames, String typeManifoldClassName, String ext, String regex )
{
 if( typeManifoldClassName != null )
 {
  Set<String> regexes = typeNames.computeIfAbsent( typeManifoldClassName, tm -> new HashSet<>() );
  regexes.add( regex );
 }
 else
 {
  boolean all = "*".equals( ext );
  _tp.getHost().getSingleModule().getTypeManifolds().stream()
   .filter( tm -> tm.getContributorKind() != ContributorKind.Supplemental )
   .forEach( tm ->
    {
     boolean match = !all && tm.handlesFileExtension( ext );
     if( all || match )
     {
      String classname = tm.getClass().getTypeName();
      Set<String> regexes = typeNames.computeIfAbsent( classname, e -> new HashSet<>() );
      regexes.add( regex );
     }
    } );
 }
}
origin: manifold-systems/manifold

IFile getIResourceFromJavaFile( URL location )
{
 return getHost().getFileSystem().getIFile( getFileFromURL( location ) );
}
origin: manifold-systems/manifold

private ClassSymbols( IModule module )
 _module.getHost().addTypeSystemListenerAsWeakRef( module, new CacheClearer() );
 _altJavacTask_PlainFileMgr = LocklessLazyVar.make( () -> {
  init();
origin: manifold-systems/manifold

expr = _tp.getHost().getJavaParser().parseExpr( comp.getExpr(), errorHandler );
if( transferParseErrors( literalOffset, comp, expr, errorHandler ) )
manifold.api.hostIManifoldHost

Javadoc

Implementors of this interface drive Manifold in a custom way based on the environment employing Manifold's services. These include:
  • Runtime class loaders - core Manifold
  • Compilers - the Manifold javac plugin
  • IDEs - the Manifold IntelliJ IDEA plugin

Most used methods

  • getFileSystem
  • getJavaParser
  • getSingleModule
  • addTypeSystemListenerAsWeakRef
  • getActualClassLoader
  • isPathIgnored

Popular in Java

  • Finding current android device location
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Socket (java.net)
    Provides a client-side TCP socket.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now