You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/01/28 12:26:44 UTC

[GitHub] blackleg commented on issue #395: [NETBEANS-138] Fixed InjectedTasksSupportTest test.

blackleg commented on issue #395: [NETBEANS-138] Fixed InjectedTasksSupportTest test.
URL: https://github.com/apache/incubator-netbeans/pull/395#issuecomment-361059089
 
 
   @matthiasblaesing I'm not sure but I think it tests the possibility to extends a indexer with a callable. 
   ```java
   private static final class CustomIndexerImpl extends CustomIndexer {
   
           private static final Logger LOG = Logger.getLogger(CustomIndexerImpl.class.getName());
   
           private final Callable<?> preAction;
           private final Callable<?> postAction;
   
           public CustomIndexerImpl(
                   @NullAllowed final Callable<?> preAction,
                   @NullAllowed final Callable<?> postAction) {
               this.preAction = preAction;
               this.postAction = postAction;
               LOG.info(String.format("%s, %s", preAction, postAction));
           }
   
           @Override
           protected void index(Iterable<? extends Indexable> files, Context context) {
               try {
                   if (preAction != null) {
                       preAction.call();
                   }
                   final IndexingSupport is = IndexingSupport.getInstance(context);
                   for (Indexable file : files) {
                       LOG.info(String.format("Indexing file. MimeType: %s", file.getMimeType()));
                       final IndexDocument doc = is.createDocument(file);
                       final FileObject fo = URLMapper.findFileObject(file.getURL());
                       doc.addPair(KEY_NAME, fo.getName(), true, true);
                       doc.addPair(KEY_EXT, fo.getExt(), true, true);
                       is.addDocument(doc);
                   }
                   if (postAction != null) {
                       postAction.call();
                   }
               } catch (Exception ioe) {
                   Exceptions.printStackTrace(ioe);
               }
           }
   
       }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists