Search in sources :

Example 1 with ProjectTreeStateUpdateDto

use of org.eclipse.che.api.project.shared.dto.event.ProjectTreeStateUpdateDto in project che by eclipse.

the class ProjectTreeTracker method getDeleteOperation.

private Consumer<String> getDeleteOperation(String endpointId) {
    return it -> {
        timers.add(it);
        new Timer().schedule(new TimerTask() {

            @Override
            public void run() {
                if (timers.contains(it)) {
                    timers.remove(it);
                    ProjectTreeStateUpdateDto params = newDto(ProjectTreeStateUpdateDto.class).withPath(it).withType(DELETED);
                    transmitter.transmitOneToNone(endpointId, OUTGOING_METHOD, params);
                }
            }
        }, 1_000L);
    };
}
Also used : ProjectTreeTrackingOperationDto(org.eclipse.che.api.project.shared.dto.event.ProjectTreeTrackingOperationDto) RequestTransmitter(org.eclipse.che.api.core.jsonrpc.RequestTransmitter) ProjectTreeStateUpdateDto(org.eclipse.che.api.project.shared.dto.event.ProjectTreeStateUpdateDto) HashMap(java.util.HashMap) Timer(java.util.Timer) Singleton(javax.inject.Singleton) CREATED(org.eclipse.che.api.project.shared.dto.event.FileWatcherEventType.CREATED) Inject(javax.inject.Inject) FileWatcherManager(org.eclipse.che.api.vfs.watcher.FileWatcherManager) Map(java.util.Map) BiConsumer(java.util.function.BiConsumer) TimerTask(java.util.TimerTask) Collectors.toSet(java.util.stream.Collectors.toSet) Logger(org.slf4j.Logger) Predicate(java.util.function.Predicate) Type(org.eclipse.che.api.project.shared.dto.event.ProjectTreeTrackingOperationDto.Type) Sets.newConcurrentHashSet(com.google.common.collect.Sets.newConcurrentHashSet) DtoFactory.newDto(org.eclipse.che.dto.server.DtoFactory.newDto) Set(java.util.Set) Consumer(java.util.function.Consumer) RequestHandlerConfigurator(org.eclipse.che.api.core.jsonrpc.RequestHandlerConfigurator) Entry(java.util.Map.Entry) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) DELETED(org.eclipse.che.api.project.shared.dto.event.FileWatcherEventType.DELETED) EMPTY_CONSUMER(org.eclipse.che.api.vfs.watcher.FileWatcherManager.EMPTY_CONSUMER) Timer(java.util.Timer) TimerTask(java.util.TimerTask) ProjectTreeStateUpdateDto(org.eclipse.che.api.project.shared.dto.event.ProjectTreeStateUpdateDto)

Aggregations

Sets.newConcurrentHashSet (com.google.common.collect.Sets.newConcurrentHashSet)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Set (java.util.Set)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 BiConsumer (java.util.function.BiConsumer)1 Consumer (java.util.function.Consumer)1 Predicate (java.util.function.Predicate)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 Inject (javax.inject.Inject)1 Singleton (javax.inject.Singleton)1 RequestHandlerConfigurator (org.eclipse.che.api.core.jsonrpc.RequestHandlerConfigurator)1 RequestTransmitter (org.eclipse.che.api.core.jsonrpc.RequestTransmitter)1 CREATED (org.eclipse.che.api.project.shared.dto.event.FileWatcherEventType.CREATED)1 DELETED (org.eclipse.che.api.project.shared.dto.event.FileWatcherEventType.DELETED)1 ProjectTreeStateUpdateDto (org.eclipse.che.api.project.shared.dto.event.ProjectTreeStateUpdateDto)1 ProjectTreeTrackingOperationDto (org.eclipse.che.api.project.shared.dto.event.ProjectTreeTrackingOperationDto)1 Type (org.eclipse.che.api.project.shared.dto.event.ProjectTreeTrackingOperationDto.Type)1