Merge "Added message to notify when simulation is unsupported."

This commit is contained in:
Brad Miller (WPI)
2014-10-28 13:48:04 -07:00
committed by Gerrit Code Review
3 changed files with 58 additions and 2 deletions

View File

@@ -0,0 +1,44 @@
package edu.wpi.first.wpilib.plugins.core.launching;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
public class SimulationNotification {
private static final String URL = "https://wpilib.screenstepslive.com/s/4485/m/23353";
private static final String SIMULATION_UNSUPPORTED_MSG =
"Simulation is unsupported on your current setup.\n" +
"For more information see: " + URL;
public static void showUnsupported() {
String title = "Simulation Unsupported";
String message = SIMULATION_UNSUPPORTED_MSG;
JOptionPane.showMessageDialog(null, message, title, JOptionPane.OK_OPTION);
try {
Desktop.getDesktop().browse(new URI(URL));
} catch (IOException e) {
WPILibCore.logError("Can't open "+URL, e);
} catch (URISyntaxException e) {
WPILibCore.logError("Can't open "+URL, e);
}
}
public static boolean supportsSimulation() {
String[] cmd = {"frcsim", "--version"};
try {
DebugPlugin.exec(cmd, new File(System.getProperty("user.home")));
return true;
} catch (CoreException e) {
return false;
}
}
}