if( validFileSystemResourceTypeAnnotation.value() == FileSystemResourceType.FOLDER )
{
treeViewer.addFilter( new ContainersOnlyViewerFilter() );
}
final FileExtensionsService fileExtensionsService = value.service( FileExtensionsService.class );
if( fileExtensionsService != null )
{
final ExtensionBasedViewerFilter filter = new ExtensionBasedViewerFilter( fileExtensionsService.extensions() );
treeViewer.addFilter( filter );
final Listener listener = new Listener()
{
@Override
public void handle( final Event event )
{
filter.change( fileExtensionsService.extensions() );
treeViewer.refresh();
}
};
fileExtensionsService.attach( listener );
tree.addDisposeListener
(
new DisposeListener()
{
public void widgetDisposed( final DisposeEvent event )
{
fileExtensionsService.detach( listener );
}
}
);
}
}