1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.theplugin.idea.action.bamboo;
18
19 import com.atlassian.theplugin.commons.bamboo.BambooStatusChecker;
20 import com.atlassian.theplugin.commons.util.Logger;
21 import com.atlassian.theplugin.idea.IdeaHelper;
22 import com.atlassian.theplugin.idea.ProgressAnimationProvider;
23 import com.atlassian.theplugin.idea.ThePluginProjectComponent;
24 import com.atlassian.theplugin.util.PluginUtil;
25 import com.intellij.openapi.actionSystem.AnAction;
26 import com.intellij.openapi.actionSystem.AnActionEvent;
27
28 public class RefreshBambooPanelAction extends AnAction {
29
30 @Override
31 public void actionPerformed(final AnActionEvent e) {
32 final ThePluginProjectComponent currentProject = IdeaHelper.getCurrentProjectComponent(e);
33 if (currentProject == null) {
34 return;
35 }
36
37 final BambooStatusChecker checker = currentProject.getBambooStatusChecker();
38
39 if (checker.canSchedule()) {
40
41 final ProgressAnimationProvider animator =
42 IdeaHelper.getBambooToolWindowPanel(e).getProgressAnimation();
43
44 final Logger log = PluginUtil.getLogger();
45
46 new Thread(new Runnable() {
47 public void run() {
48
49 Thread t = new Thread(checker.newTimerTask(), "Manual Bamboo panel refresh (checker)");
50
51 animator.startProgressAnimation();
52
53 t.start();
54 try {
55 t.join();
56 } catch (InterruptedException e) {
57 log.warn(e.toString());
58 } finally {
59 animator.stopProgressAnimation();
60 }
61
62
63 }
64 }, "Manual Bamboo panel refresh").start();
65
66 }
67 }
68 }