package com.tagmycode.intellij;

import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
import com.tagmycode.plugin.AbstractTaskFactory;
import com.tagmycode.plugin.operation.TagMyCodeAsynchronousOperation;
import org.jetbrains.annotations.NotNull;


public class TaskFactory extends AbstractTaskFactory {
    private TagMyCodeProject tagMyCodeProject;

    public TaskFactory(TagMyCodeProject project) {
        this.tagMyCodeProject = project;
    }

    @Override
    public void create(final TagMyCodeAsynchronousOperation operation, final Runnable runnable, final String title) {
        final Thread thread = new Thread(runnable);

        new Task.Backgroundable(tagMyCodeProject.getProject(), title, true) {
            public void run(@NotNull final ProgressIndicator indicator) {
                thread.start();

                while (thread.isAlive()) {
                    if (indicator.isCanceled()) {
                        thread.interrupt();
                        indicator.cancel();
                    }
                }
            }
        }.queue();

    }

}

@@ -178,78 +178,8 @@
 ry;%0A
-import com.tagmycode.plugin.operation.TagMyCodeAsynchronousOperation;%0A
 impo
@@ -467,56 +467,8 @@
 nal 
-TagMyCodeAsynchronousOperation operation, final 
 Runn
@@ -1003,11 +1003,10 @@
 %0A%0A    %7D%0A
-%0A
 %7D%0A

fix to version