From ba12ae3aa7242d9706e4b2f38648e73e4c7ecf2d Mon Sep 17 00:00:00 2001 From: Jarmo Isotalo Date: Thu, 18 Sep 2014 21:41:02 +0200 Subject: [PATCH 1/3] Let logger use correct class name --- tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java index f46eded2..bbfe0317 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java @@ -45,7 +45,7 @@ //plz remove everything that isn't needed here. --kviiri public final class PastebinAction extends AbstractExerciseSensitiveAction { - private static final Logger log = Logger.getLogger(RequestReviewAction.class.getName()); + private static final Logger log = Logger.getLogger(PastebinAction.class.getName()); private TmcSettings settings; private CourseDb courseDb; private ProjectMediator projectMediator; From 3c3f990a779a5409b781d584c24c0a7f3e08a8a3 Mon Sep 17 00:00:00 2001 From: Jarmo Isotalo Date: Sat, 20 Sep 2014 00:17:34 +0200 Subject: [PATCH 2/3] Added modified icons for run tests locally button --- .../cs/tmc/actions/testProjectGreen.png | Bin 0 -> 760 bytes .../cs/tmc/actions/testProjectGreen24.png | Bin 0 -> 1070 bytes .../helsinki/cs/tmc/actions/testProjectRed.png | Bin 0 -> 15112 bytes .../cs/tmc/actions/testProjectRed24.png | Bin 0 -> 15362 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tmc-plugin/src/fi/helsinki/cs/tmc/actions/testProjectGreen.png create mode 100644 tmc-plugin/src/fi/helsinki/cs/tmc/actions/testProjectGreen24.png create mode 100644 tmc-plugin/src/fi/helsinki/cs/tmc/actions/testProjectRed.png create mode 100644 tmc-plugin/src/fi/helsinki/cs/tmc/actions/testProjectRed24.png diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/testProjectGreen.png b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/testProjectGreen.png new file mode 100644 index 0000000000000000000000000000000000000000..f2b955b2c83620aa68df076170b7a5f64a0ecaf0 GIT binary patch literal 760 zcmV+uD}{~zsR zcmTx20+1dU8z6vK{xkj)7ZKoMAO(Q*z}Nr*#Ps*iKSl-;0kR%|00M@=Kdg#AeE-I< z>&9D#3s0Ui+HdS44;4hgsTGxAf~@q40!&Dks*8aQijb}cQKs1 zc7fr>`OgfBqV5c97v5z!`sggfg}<*EGK#AVKxzR3i0SvAzYGja%y9hdGZVwqqkkFL z*clk?yd)XkzWB@V_|8v;c{A5BsObqXSbK;tu(1DT`2FkGf#lp01AqVmyMU2}1CD1N z`p)3z>(9W(!OS2a$j!hn$N_g54<9>&pdc?;E-c8O|JTo-8vp``2^0oQY&>xM^22uq zD@zLob`C~{UqHV)`zkS*J4iBEI7%_N1tet_jbYJUCtDGv}p;6P+#<%ZkB&-Rbu z@ypi?rJ1`JCd~C@;O7x#$f^ZlKDc|U0w91Gb9@#5x7C%w4fy`! z7sKI;j~Gt95@fJ|58bYz7D*#!PSd|LD>9=kI@p z&)@$ry!#{c^e3|*69XHsBuM=CkFQs`7(V{^|LMt&y_ep!{r~^}8$bYoQj{^CM8^b5 qY@oyk#Xq5W>IG2qTaW^P00RKMWBdLSCRpzP0000|3Cj1F)}b}Q)1wMhW}R?Ss3H8dXAj~ z@c{w|Zo&6&45pg8rkVz>@f5lE!tRBd*Ds$j1v0@F00a=+ffB=Fg)4zZJQ7vgAn*|U+Oh~p;%>rbz z00Ic%gMU=?0g_n&0mMR%1?Qi$Fm$Y1!SLkOL%5ifs4PQOcoc)7ijQ=^TO?Ipt6VWnHcI79Tgh} zIi}wX9|Ub!r}eb_0SF+ZAOf1e#EcdHV`OHy^@fR|WZ4>qXYZ~v=vfFbeE#sC;mO_K z;A~@I3xFtD(&Fv!XafaQPxd%^Jg*Y7z$fBZB82q2V5 zW@Ki=inm<+%HZQ4%)rU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+){I*fA{C}o_lTe z^luhrnytU_}(ke@3i@bdQWy%cTjzk asf?Tnb1!Fj`qXz-%Ze-P`+v52<9`9;c)n=> literal 0 HcmV?d00001 diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/testProjectRed24.png b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/testProjectRed24.png new file mode 100644 index 0000000000000000000000000000000000000000..f0345ae134707c926142b115784c0ac699779f27 GIT binary patch literal 15362 zcmeI3dsGuw9>*tg7L`ibDhmpV*>EhynoORC#1NMf1e6d&Kt!=jk^u&iOiTt7P<+%E zSgWgLMXaUu)ha%)>tlN?zSak>uWfDZ@wF&tRfBp5gwN?#`31h zv_h>l9xo)4%53HHE*J(Cc>`G@W&lOh*Yp)41`Z4d==PGQL45l5*t=fk-Bj#)!sn#X^w;6-rQ%gf9{+g$kue#`S!7 z>HuJ=Y{qMBb0*zRXr{B8%O_4p2m$m=zTXgs3kkqrvNA zEwPzgOEVf!+=QEP3uOm>BA^YoRzsgEF7AnK4RD zn6UyJwOR^PXxAX5^tO~To-~m*uq<3HQK7zuAum^(DU&UB3bPpSWQ`gO2nfQc9BY*3 zi}dmsz68gle5p__=j&xgoR5oTdZ}C?(Tl_~7euWVcJCEhLmEoxt>Ou7{FR|0_gOT5n!bG?ZBr9gK*Jzb~0+!dbg>DuL)X(1@J*psctFyuv_x$ZMz z3V1xg)njEc3D~+lhkJUY5l-Bcts%hXwbLyrmU?`8PWW`3)|VqR;c;}A3i?Oxs-$}q zJSKoA6x92O(!I#uUGN(lU3c^w2ZqD3Nnjd`Hj9f95iDSF!890c78fHTSis_fX)xL> zE=EMKfW-yVV6<6WjEG!m;30^amyNJ`ftNZBX^S+EE}o;(NFRs<;#BFNo51W~R-kWg~X+b1U=h~La)Ob|wp zQ)XlaFFjIz0b7bK4vDUgTk_8N%be-_$mM~R2euZ=!N` zym8x>e&BD#u!=R;oBla-Mpa%y^7q3Re7h-YjBa``xZYW@{odV#@bgz@o*Hv^6DNO8 z?&k|yT9`ik8?a_^sbaLz5leJcD*&P zD#~vOwXrZb?iHi?`ib2elk4iw-9Ec_azAtK<;T>cA-c9bg2nfXs#dSbD43wl33~6x z%#iDu!?)}Ze>62WwDH-vb8ElN8grJHmUdLu%)20}j5W)3+SI>{TD&twmtI~by>MsO zwa=qo-*)!lKm{jk=ZS>5jenT;K=o$!+SQXj6FYBqnmLWN^ZvLo;ml93UqZi{m9;DP z_~AB(L^wO_VuR^W{qi~QUgT`M@bK#y2UiY%m@cS1c_sV6k{y%cFCQpBzO#Dg`(HcK^7LB7*7kQ3PlwlRu|6uf&%d_#{qIk%TX$+$_^Hs=CC7%E$-|oY)5jSM zn@3azoli-wn|{XDVZ1TtyA}G0MYS!3KM6k^-<}v0^k=d2)qAEv?JYNWs|Sp1o993O z?&zGH#~R(wwR1Q#^XB~cj=lqo;`^8=VG-j*MA;D+vP zRqD@`Lw@O)6&2g46izs(dv-OPjHr0LYDdkHx2&Ubo@Ln8>edioR@_B+?yvsC^#t+E>q!s`Tb3y8~7=K8RUaxGR@)y++^{ jwr64VYpuWQC`NYqmk&Cde&re1l}K_zs%H0FdGGueIT%Y7 literal 0 HcmV?d00001 From 3452dd754e27749701f775fb51c591ce4d85c351 Mon Sep 17 00:00:00 2001 From: Jarmo Isotalo Date: Sat, 20 Sep 2014 00:18:31 +0200 Subject: [PATCH 3/3] Changing icon based on exercise works --- .../cs/tmc/actions/RunTestsLocallyAction.java | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/RunTestsLocallyAction.java b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/RunTestsLocallyAction.java index dd81292e..418bc1cf 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/RunTestsLocallyAction.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/RunTestsLocallyAction.java @@ -6,6 +6,12 @@ import fi.helsinki.cs.tmc.model.ProjectMediator; import fi.helsinki.cs.tmc.runners.CheckstyleRunHandler; import fi.helsinki.cs.tmc.runners.TestRunHandler; +import java.awt.Component; +import java.awt.Graphics; +import java.beans.PropertyChangeEvent; +import java.net.URL; +import javax.swing.Icon; +import javax.swing.ImageIcon; import org.netbeans.api.project.Project; import org.openide.nodes.Node; import org.openide.util.NbBundle.Messages; @@ -20,12 +26,18 @@ public class RunTestsLocallyAction extends AbstractExerciseSensitiveAction imple private TestRunHandler testRunHandler; private Project project; + private static final String GREEN_EYE = "testProjectGreen24.png"; + private static final String RED_EYE = "testProjectRed24.png"; + public RunTestsLocallyAction() { this.courseDb = CourseDb.getInstance(); this.projectMediator = ProjectMediator.getInstance(); this.checkstyleRunHandler = new CheckstyleRunHandler(); this.testRunHandler = new TestRunHandler(); putValue("noIconInMenu", Boolean.TRUE); + + URL imgURL = getClass().getResource(GREEN_EYE); + setIcon(new ImageIcon(imgURL, "")); } @Override @@ -55,14 +67,28 @@ public String getName() { @Override protected String iconResource() { - // The setting in layer.xml doesn't work with NodeAction - return "org/netbeans/modules/project/ui/resources/testProject.png"; + return null; + } + + private Icon getIcon(Exercise exercise) { + String name = GREEN_EYE; + if (exercise != null) { + name = exercise.isReturnable() ? GREEN_EYE : RED_EYE; + } + System.out.println("exercise: " + exercise + " color: " + name); + URL imgURL = getClass().getResource(name); + return new ImageIcon(imgURL, ""); + } + + private void updateIcon(Exercise exercise) { + setIcon(getIcon(exercise)); } @Override protected boolean enabledFor(Exercise exercise) { - // Overridden to not care about the deadline - return exercise.isReturnable(); + // This gets always called when changing projects related to tmc + updateIcon(exercise); + return true; } @Override