Skip to content

Commit 04badfe

Browse files
committed
Add logger warning if can't detect outdated netbeans
1 parent 3989d8b commit 04badfe

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
import fi.helsinki.cs.tmc.core.holders.TmcSettingsHolder;
44
import fi.helsinki.cs.tmc.ui.TmcNotificationDisplayer;
5+
6+
import java.awt.HeadlessException;
7+
import java.util.logging.Logger;
58
import javax.swing.JOptionPane;
9+
610
import org.openide.awt.NotificationDisplayer;
711
import org.openide.util.ImageUtilities;
812

913
public class CheckForOutdatedNetbeans {
1014

1115
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.";
16+
private static final String OUTDATED_MESSAGE = "Your Netbeans is too old and it may not work with the TestMyCode plugin.\nWe recommend that you update your Netbeans to at least version 8.2.";
17+
private static final Logger logger = Logger.getLogger(CheckForOutdatedNetbeans.class.getName());
1318

1419
public static void run() {
1520
TmcNotificationDisplayer.SingletonToken NOTIFIER_TOKEN = TmcNotificationDisplayer.createSingletonToken();
@@ -18,10 +23,10 @@ public static void run() {
1823
final String hostProgramVersion = TmcSettingsHolder.get().hostProgramVersion().substring(0, 4);
1924
final int version = Integer.parseInt(hostProgramVersion);
2025
if (version > 2000 && version < 2015) {
21-
JOptionPane.showMessageDialog(null, OUTDATED_MESSAGE, OUTDATED_TITLE, JOptionPane.ERROR_MESSAGE);
2226
notifier.notify(NOTIFIER_TOKEN, OUTDATED_TITLE, ImageUtilities.loadImageIcon("fi/helsinki/cs/tmc/smile.gif", false), OUTDATED_MESSAGE, null, NotificationDisplayer.Priority.HIGH);
2327
}
24-
} catch (Exception ex) {
28+
} catch (HeadlessException | NumberFormatException ex) {
29+
logger.warning("Could not check for an outdated Netbeans.");
2530
}
2631
}
2732
}

0 commit comments

Comments
 (0)