Skip to content

Commit 3989d8b

Browse files
committed
Nag outdated netbeans users to update netbeans
1 parent 90a8d40 commit 3989d8b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package fi.helsinki.cs.tmc.actions;
2+
3+
import fi.helsinki.cs.tmc.core.holders.TmcSettingsHolder;
4+
import fi.helsinki.cs.tmc.ui.TmcNotificationDisplayer;
5+
import javax.swing.JOptionPane;
6+
import org.openide.awt.NotificationDisplayer;
7+
import org.openide.util.ImageUtilities;
8+
9+
public class CheckForOutdatedNetbeans {
10+
11+
private static final String OUTDATED_TITLE = "Please update your Netbeans.";
12+
private static final String OUTDATED_MESSAGE = "Your Netbeans is too old and doesn't work with the TestMyCode plugin.\nWe recommend that you update your Netbeans to at least version 8.2.";
13+
14+
public static void run() {
15+
TmcNotificationDisplayer.SingletonToken NOTIFIER_TOKEN = TmcNotificationDisplayer.createSingletonToken();
16+
TmcNotificationDisplayer notifier = TmcNotificationDisplayer.getDefault();
17+
try {
18+
final String hostProgramVersion = TmcSettingsHolder.get().hostProgramVersion().substring(0, 4);
19+
final int version = Integer.parseInt(hostProgramVersion);
20+
if (version > 2000 && version < 2015) {
21+
JOptionPane.showMessageDialog(null, OUTDATED_MESSAGE, OUTDATED_TITLE, JOptionPane.ERROR_MESSAGE);
22+
notifier.notify(NOTIFIER_TOKEN, OUTDATED_TITLE, ImageUtilities.loadImageIcon("fi/helsinki/cs/tmc/smile.gif", false), OUTDATED_MESSAGE, null, NotificationDisplayer.Priority.HIGH);
23+
}
24+
} catch (Exception ex) {
25+
}
26+
}
27+
}

tmc-plugin/src/fi/helsinki/cs/tmc/actions/TmcModuleInstall.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public void restored() {
4343
WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
4444
@Override
4545
public void run() {
46+
CheckForOutdatedNetbeans.run();
4647

4748
TmcCore.setInstance(new TmcCore());
4849

0 commit comments

Comments
 (0)