// Path: SVNToolBox/src/main/java/zielu/svntoolbox/extensions/NodeDecorationEP.java
// public class NodeDecorationEP extends AbstractExtensionPointBean implements Comparable<NodeDecorationEP> {
//     public final static ExtensionPointName<NodeDecorationEP> 
//             POINT_NAME = ExtensionPointName.create("zielu.svntoolbox.nodeDecorationPoint");
//     
//     @Attribute("priority")
//     public Integer priority;
//     
//     @Attribute("implementationClass")
//     public String implementationClass;
//     
//     public NodeDecoration instantiate() {
//         try {
//             return instantiate(implementationClass, ApplicationManager.getApplication().getPicoContainer());
//         } catch (ClassNotFoundException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     @Override
//     public int compareTo(NodeDecorationEP o) {
//         return priority.compareTo(o.priority);
//     }
// }
// 
// Path: SVNToolBox/src/main/java/zielu/svntoolbox/ui/projectView/NodeDecoration.java
// public interface NodeDecoration {
//     boolean isForMe(ProjectViewNode node);
//     NodeDecorationType getType();
//     void decorate(ProjectViewNode node, PresentationData data);
// }
// 
// Path: SVNToolBox/src/main/java/zielu/svntoolbox/ui/projectView/impl/EmptyDecoration.java
// public class EmptyDecoration implements NodeDecoration {
//     public static final NodeDecoration INSTANCE = new EmptyDecoration();
//     
//     @Override
//     public boolean isForMe(ProjectViewNode node) {
//         return true;
//     }
// 
//     @Override
//     public NodeDecorationType getType() {
//         return NodeDecorationType.Other;
//     }
// 
//     @Override
//     public void decorate(ProjectViewNode node, PresentationData data) {
//     }
// }


import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.intellij.ide.projectView.ProjectViewNode;
import com.intellij.notification.NotificationDisplayType;
import com.intellij.notification.NotificationGroup;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import org.jetbrains.annotations.NotNull;
import zielu.svntoolbox.extensions.NodeDecorationEP;
import zielu.svntoolbox.ui.projectView.NodeDecoration;
import zielu.svntoolbox.ui.projectView.impl.EmptyDecoration;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
    public void initComponent() {
        notification = new NotificationGroup("SVN ToolBox Messages", NotificationDisplayType.STICKY_BALLOON, true);
        myExecutor = Executors.newCachedThreadPool(
                new ThreadFactoryBuilder()
                        .setDaemon(true)
                        .setNameFormat(getComponentName()+"-pool-%s")
                        .setPriority(Thread.NORM_PRIORITY)
                        .build()
        );
        myScheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder()
                .setDaemon(true)
                .setNameFormat(getComponentName() + "-scheduled-pool-%s")
                .setPriority(Thread.NORM_PRIORITY)
                .build()
        );
        List<NodeDecorationEP> nodeDecorationEPs = Arrays.asList(Extensions.getExtensions(NodeDecorationEP.POINT_NAME));
        Collections.sort(nodeDecorationEPs);
        for (NodeDecorationEP decorationEP : nodeDecorationEPs) {
            NodeDecoration decoration = decorationEP.instantiate();
            myNodeDecorations.add(decoration);
          log.debug("Added decoration ", decorationEP.priority, " ", decoration);
        }
    }

    public NodeDecoration decorationFor(ProjectViewNode node) {
        for (NodeDecoration candidate : myNodeDecorations) {
            if (candidate.isForMe(node)) {
                return candidate;
            }
        }
// Path: SVNToolBox/src/main/java/zielu/svntoolbox/extensions/NodeDecorationEP.java
// public class NodeDecorationEP extends AbstractExtensionPointBean implements Comparable<NodeDecorationEP> {
//     public final static ExtensionPointName<NodeDecorationEP> 
//             POINT_NAME = ExtensionPointName.create("zielu.svntoolbox.nodeDecorationPoint");
//     
//     @Attribute("priority")
//     public Integer priority;
//     
//     @Attribute("implementationClass")
//     public String implementationClass;
//     
//     public NodeDecoration instantiate() {
//         try {
//             return instantiate(implementationClass, ApplicationManager.getApplication().getPicoContainer());
//         } catch (ClassNotFoundException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     @Override
//     public int compareTo(NodeDecorationEP o) {
//         return priority.compareTo(o.priority);
//     }
// }
// 
// Path: SVNToolBox/src/main/java/zielu/svntoolbox/ui/projectView/NodeDecoration.java
// public interface NodeDecoration {
//     boolean isForMe(ProjectViewNode node);
//     NodeDecorationType getType();
//     void decorate(ProjectViewNode node, PresentationData data);
// }
// 
// Path: SVNToolBox/src/main/java/zielu/svntoolbox/ui/projectView/impl/EmptyDecoration.java
// public class EmptyDecoration implements NodeDecoration {
//     public static final NodeDecoration INSTANCE = new EmptyDecoration();
//     
//     @Override
//     public boolean isForMe(ProjectViewNode node) {
//         return true;
//     }
// 
//     @Override
//     public NodeDecorationType getType() {
//         return NodeDecorationType.Other;
//     }
// 
//     @Override
//     public void decorate(ProjectViewNode node, PresentationData data) {
//     }
// }


// Path: SVNToolBox/src/main/java/zielu/svntoolbox/SvnToolBoxApp.java
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.intellij.ide.projectView.ProjectViewNode;
import com.intellij.notification.NotificationDisplayType;
import com.intellij.notification.NotificationGroup;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import org.jetbrains.annotations.NotNull;
import zielu.svntoolbox.extensions.NodeDecorationEP;
import zielu.svntoolbox.ui.projectView.NodeDecoration;
import zielu.svntoolbox.ui.projectView.impl.EmptyDecoration;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

    public void initComponent() {
        notification = new NotificationGroup("SVN ToolBox Messages", NotificationDisplayType.STICKY_BALLOON, true);
        myExecutor = Executors.newCachedThreadPool(
                new ThreadFactoryBuilder()
                        .setDaemon(true)
                        .setNameFormat(getComponentName()+"-pool-%s")
                        .setPriority(Thread.NORM_PRIORITY)
                        .build()
        );
        myScheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder()
                .setDaemon(true)
                .setNameFormat(getComponentName() + "-scheduled-pool-%s")
                .setPriority(Thread.NORM_PRIORITY)
                .build()
        );
        List<NodeDecorationEP> nodeDecorationEPs = Arrays.asList(Extensions.getExtensions(NodeDecorationEP.POINT_NAME));
        Collections.sort(nodeDecorationEPs);
        for (NodeDecorationEP decorationEP : nodeDecorationEPs) {
            NodeDecoration decoration = decorationEP.instantiate();
            myNodeDecorations.add(decoration);
          log.debug("Added decoration ", decorationEP.priority, " ", decoration);
        }
    }

    public NodeDecoration decorationFor(ProjectViewNode node) {
        for (NodeDecoration candidate : myNodeDecorations) {
            if (candidate.isForMe(node)) {
                return candidate;
            }
        }
        return EmptyDecoration.INSTANCE;