removed temporary plugins, fixed compiler warnings, using new cooja projects class

This commit is contained in:
fros4943 2010-12-02 15:29:07 +00:00
parent 6f66d45917
commit 773fbf8727

View File

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: GUI.java,v 1.171 2010/09/24 12:48:04 fros4943 Exp $
* $Id: GUI.java,v 1.172 2010/12/02 15:29:07 fros4943 Exp $
*/
package se.sics.cooja;
@ -148,6 +148,10 @@ import se.sics.cooja.util.ExecuteJAR;
* @author Fredrik Osterlind
*/
public class GUI extends Observable {
private static JFrame frame = null;
private static JApplet applet = null;
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(GUI.class);
/**
* External tools default Win32 settings filename.
@ -224,14 +228,6 @@ public class GUI extends Observable {
}
};
private static JFrame frame = null;
private static JApplet applet = null;
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(GUI.class);
// External tools setting names
public static Properties defaultExternalToolsSettings;
public static Properties currentExternalToolsSettings;
@ -303,7 +299,7 @@ public class GUI extends Observable {
// Maintained via method reparseProjectConfig()
private ProjectConfig projectConfig;
private Vector<File> currentProjectDirs = new Vector<File>();
private ArrayList<COOJAProject> currentProjects = new ArrayList<COOJAProject>();
public ClassLoader projectDirClassLoader;
@ -311,12 +307,8 @@ public class GUI extends Observable {
private Vector<Class<? extends Plugin>> pluginClasses = new Vector<Class<? extends Plugin>>();
private Vector<Class<? extends Plugin>> pluginClassesTemporary = new Vector<Class<? extends Plugin>>();
private Vector<Class<? extends RadioMedium>> radioMediumClasses = new Vector<Class<? extends RadioMedium>>();
private Vector<Class<? extends IPDistributor>> ipDistributorClasses = new Vector<Class<? extends IPDistributor>>();
private Vector<Class<? extends Positioner>> positionerClasses = new Vector<Class<? extends Positioner>>();
private class HighlightObservable extends Observable {
@ -407,7 +399,7 @@ public class GUI extends Observable {
String[] arr = defaultProjectDirs.split(";");
for (String p : arr) {
File projectDir = restorePortablePath(new File(p));
currentProjectDirs.add(projectDir);
currentProjects.add(new COOJAProject(projectDir));
}
}
@ -417,12 +409,13 @@ public class GUI extends Observable {
} catch (ParseProjectsException e) {
logger.fatal("Error when loading projects: " + e.getMessage(), e);
if (isVisualized()) {
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
"Default projects could not load, reconfigure project directories:" +
"\n\tMenu->Settings->COOJA projects" +
"\n\nSee console for stack trace with more information.",
"Project loading error", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
"All COOJA projects could not load.\n\n" +
"To manage COOJA projects:\n" +
"Menu->Settings->COOJA projects",
"Reconfigure COOJA projects", JOptionPane.INFORMATION_MESSAGE);
}
showErrorDialog(getTopParentContainer(), "COOJA projects load error", e, false);
}
// Start all standard GUI plugins
@ -1100,7 +1093,8 @@ public class GUI extends Observable {
private static JDesktopPane createDesktopPane() {
final JDesktopPane desktop = new JDesktopPane() {
public void setBounds(int x, int y, int w, int h) {
private static final long serialVersionUID = -8272040875621119329L;
public void setBounds(int x, int y, int w, int h) {
super.setBounds(x, y, w, h);
updateDesktopSize(this);
}
@ -1115,7 +1109,8 @@ public class GUI extends Observable {
}
};
desktop.setDesktopManager(new DefaultDesktopManager() {
public void endResizingFrame(JComponent f) {
private static final long serialVersionUID = -5987404936292377152L;
public void endResizingFrame(JComponent f) {
super.endResizingFrame(f);
updateDesktopSize(desktop);
}
@ -1228,42 +1223,6 @@ public class GUI extends Observable {
return moteTypeClasses;
}
/**
* Register new IP distributor class
*
* @param ipDistributorClass
* Class to register
* @return True if class was registered
*/
public boolean registerIPDistributor(
Class<? extends IPDistributor> ipDistributorClass) {
// Check that vector constructor exists
try {
ipDistributorClass.getConstructor(new Class[] { Vector.class });
} catch (Exception e) {
logger.fatal("No vector constructor found of IP distributor: "
+ ipDistributorClass);
return false;
}
ipDistributorClasses.add(ipDistributorClass);
return true;
}
/**
* Unregister all IP distributors.
*/
public void unregisterIPDistributors() {
ipDistributorClasses.clear();
}
/**
* @return All registered IP distributors
*/
public Vector<Class<? extends IPDistributor>> getRegisteredIPDistributors() {
return ipDistributorClasses;
}
/**
* Register new positioner class.
*
@ -1339,12 +1298,10 @@ public class GUI extends Observable {
/**
* Builds new project configuration using current project directories settings.
* Reregisters mote types, plugins, IP distributors, positioners and radio
* Reregisters mote types, plugins, positioners and radio
* mediums. This method may still return true even if all classes could not be
* registered, but always returns false if all project directory configuration
* files were not parsed correctly.
*
* Any registered temporary plugins will be saved and reregistered.
*/
public void reparseProjectConfig() throws ParseProjectsException {
if (PROJECT_DEFAULT_CONFIG_FILENAME == null) {
@ -1355,40 +1312,29 @@ public class GUI extends Observable {
}
}
// Backup temporary plugins
Vector<Class<? extends Plugin>> oldTempPlugins =
(Vector<Class<? extends Plugin>>) pluginClassesTemporary.clone();
// Reset current configuration
/* Remove current dependencies */
unregisterMoteTypes();
unregisterPlugins();
unregisterIPDistributors();
unregisterPositioners();
unregisterRadioMediums();
projectDirClassLoader = null;
/* Build cooja configuration */
try {
// Read default configuration
projectConfig = new ProjectConfig(true);
} catch (FileNotFoundException e) {
logger.fatal("Could not find default project config file: "
+ PROJECT_DEFAULT_CONFIG_FILENAME);
logger.fatal("Could not find default project config file: " + PROJECT_DEFAULT_CONFIG_FILENAME);
throw (ParseProjectsException) new ParseProjectsException(
"Could not find default project config file: "
+ PROJECT_DEFAULT_CONFIG_FILENAME).initCause(e);
"Could not find default project config file: " + PROJECT_DEFAULT_CONFIG_FILENAME).initCause(e);
} catch (IOException e) {
logger.fatal("Error when reading default project config file: "
+ PROJECT_DEFAULT_CONFIG_FILENAME);
logger.fatal("Error when reading default project config file: " + PROJECT_DEFAULT_CONFIG_FILENAME);
throw (ParseProjectsException) new ParseProjectsException(
"Error when reading default project config file: "
+ PROJECT_DEFAULT_CONFIG_FILENAME).initCause(e);
"Error when reading default project config file: " + PROJECT_DEFAULT_CONFIG_FILENAME).initCause(e);
}
if (!isVisualizedInApplet()) {
// Append project directory configurations
for (File projectDir : currentProjectDirs) {
for (COOJAProject project: currentProjects) {
try {
// Append config to general config
projectConfig.appendProjectDir(projectDir);
projectConfig.appendProjectDir(project.dir);
} catch (FileNotFoundException e) {
throw (ParseProjectsException) new ParseProjectsException(
"Error when loading project: " + e.getMessage()).initCause(e);
@ -1397,16 +1343,14 @@ public class GUI extends Observable {
"Error when reading project config: " + e.getMessage()).initCause(e);
}
}
// Create class loader
/* Create project class loader */
try {
projectDirClassLoader = createClassLoader(currentProjectDirs);
projectDirClassLoader = createClassLoader(currentProjects);
} catch (ClassLoaderCreationException e) {
throw (ParseProjectsException) new ParseProjectsException(
"Error when creating class loader").initCause(e);
}
} else {
projectDirClassLoader = null;
}
// Register mote types
@ -1446,37 +1390,6 @@ public class GUI extends Observable {
}
}
// Reregister temporary plugins again
if (oldTempPlugins != null) {
for (Class<? extends Plugin> pluginClass : oldTempPlugins) {
if (registerTemporaryPlugin(pluginClass)) {
// logger.info("Reregistered temporary plugin class: " +
// getDescriptionOf(pluginClass));
} else {
logger.warn("Could not reregister temporary plugin class: "
+ getDescriptionOf(pluginClass));
}
}
}
// Register IP distributors
String[] ipDistClassNames = projectConfig.getStringArrayValue(GUI.class,
"IP_DISTRIBUTORS");
if (ipDistClassNames != null) {
for (String ipDistClassName : ipDistClassNames) {
Class<? extends IPDistributor> ipDistClass = tryLoadClass(this,
IPDistributor.class, ipDistClassName);
if (ipDistClass != null) {
registerIPDistributor(ipDistClass);
// logger.info("Loaded IP distributor class: " + ipDistClassName);
} else {
logger
.warn("Could not load IP distributor class: " + ipDistClassName);
}
}
}
// Register positioners
String[] positionerClassNames = projectConfig.getStringArrayValue(
GUI.class, "POSITIONERS");
@ -1529,8 +1442,8 @@ public class GUI extends Observable {
*
* @return Current project directories.
*/
public Vector<File> getProjectDirs() {
return currentProjectDirs;
public COOJAProject[] getProjects() {
return currentProjects.toArray(new COOJAProject[0]);
}
// // PLUGIN METHODS ////
@ -1782,57 +1695,26 @@ public class GUI extends Observable {
return registerPlugin(newPluginClass, true);
}
/**
* Register a temporary plugin to be included in the GUI. The plugin will be
* visible in the menubar. This plugin will automatically be unregistered if
* the current simulation is removed.
*
* @param newPluginClass
* New plugin to register
* @return True if this plugin was registered ok, false otherwise
*/
public boolean registerTemporaryPlugin(Class<? extends Plugin> newPluginClass) {
if (pluginClasses.contains(newPluginClass)) {
return false;
}
boolean returnVal = registerPlugin(newPluginClass, true);
if (!returnVal) {
return false;
}
pluginClassesTemporary.add(newPluginClass);
return true;
}
/**
* Unregister a plugin class. Removes any plugin menu items links as well.
*
* @param pluginClass
* Plugin class to unregister
* @param pluginClass Plugin class
*/
public void unregisterPlugin(Class<? extends Plugin> pluginClass) {
// Remove (if existing) plugin class menu items
/* Remove from menu */
for (Component menuComponent : menuPlugins.getMenuComponents()) {
if (menuComponent.getClass().isAssignableFrom(JMenuItem.class)) {
JMenuItem menuItem = (JMenuItem) menuComponent;
if (menuItem.getClientProperty("class").equals(pluginClass)) {
menuPlugins.remove(menuItem);
}
if (!(menuComponent instanceof JMenuItem)) {
continue;
}
JMenuItem menuItem = (JMenuItem) menuComponent;
if (menuItem.getClientProperty("class").equals(pluginClass)) {
menuPlugins.remove(menuItem);
}
}
if (menuMotePluginClasses.contains(pluginClass)) {
menuMotePluginClasses.remove(pluginClass);
}
// Remove from plugin vectors (including temporary)
if (pluginClasses.contains(pluginClass)) {
pluginClasses.remove(pluginClass);
}
if (pluginClassesTemporary.contains(pluginClass)) {
pluginClassesTemporary.remove(pluginClass);
}
menuMotePluginClasses.remove(pluginClass);
pluginClasses.remove(pluginClass);
}
/**
@ -1954,7 +1836,7 @@ public class GUI extends Observable {
}
/**
* Unregister all plugin classes, including temporary plugins.
* Unregister all plugin classes
*/
public void unregisterPlugins() {
if (menuPlugins != null) {
@ -1968,7 +1850,6 @@ public class GUI extends Observable {
menuMotePluginClasses.clear();
}
pluginClasses.clear();
pluginClassesTemporary.clear();
}
/**
@ -2027,7 +1908,7 @@ public class GUI extends Observable {
// Set frame title
if (frame != null) {
frame.setTitle("COOJA Simulator" + " - " + sim.getTitle());
frame.setTitle(sim.getTitle() + " - COOJA Simulator");
}
// Open standard plugins (if none opened already)
@ -2150,14 +2031,6 @@ public class GUI extends Observable {
mySimulation = null;
updateGUIComponentState();
// Unregister temporary plugin classes
Class<? extends Plugin>[] pluginClasses =
new Class[pluginClassesTemporary.size()];
pluginClassesTemporary.toArray(pluginClasses);
for (Class<? extends Plugin> pClass: pluginClasses) {
unregisterPlugin(pClass);
}
// Reset frame title
if (isVisualizedInFrame()) {
frame.setTitle("COOJA Simulator");
@ -2861,27 +2734,28 @@ public class GUI extends Observable {
} else if (e.getActionCommand().equals("edit paths")) {
ExternalToolsDialog.showDialog(GUI.getTopParentContainer());
} else if (e.getActionCommand().equals("manage projects")) {
File[] newProjects = ProjectDirectoriesDialog.showDialog(
COOJAProject[] newProjects = ProjectDirectoriesDialog.showDialog(
GUI.getTopParentContainer(),
GUI.this,
currentProjectDirs.toArray(new File[0])
getProjects()
);
if (newProjects != null) {
currentProjectDirs.clear();
for (File p: newProjects) {
currentProjectDirs.add(p);
}
currentProjects.clear();
for (COOJAProject p: newProjects) {
currentProjects.add(p);
}
try {
reparseProjectConfig();
} catch (ParseProjectsException ex) {
logger.fatal("Error when loading projects: " + ex.getMessage(), ex);
if (isVisualized()) {
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
"Configured projects could not load, reconfigure project directories:" +
"\n\tMenu->Settings->COOJA projects" +
"\n\nSee console for stack trace with more information.",
"Project loading error", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
"All COOJA projects could not load.\n\n" +
"To manage COOJA projects:\n" +
"Menu->Settings->COOJA projects",
"Reconfigure COOJA projects", JOptionPane.INFORMATION_MESSAGE);
}
showErrorDialog(getTopParentContainer(), "COOJA projects load error", ex, false);
}
}
} else if (e.getActionCommand().equals("configuration wizard")) {
@ -2934,22 +2808,12 @@ public class GUI extends Observable {
return null;
}
public ClassLoader createProjectDirClassLoader(Vector<File> projectsDirs)
throws ParseProjectsException, ClassLoaderCreationException {
if (projectDirClassLoader == null) {
reparseProjectConfig();
}
return createClassLoader(projectDirClassLoader, projectsDirs);
private ClassLoader createClassLoader(Collection<COOJAProject> projects)
throws ClassLoaderCreationException {
return createClassLoader(ClassLoader.getSystemClassLoader(), projects);
}
private ClassLoader createClassLoader(Vector<File> currentProjectDirs)
throws ClassLoaderCreationException
{
return createClassLoader(ClassLoader.getSystemClassLoader(),
currentProjectDirs);
}
private File findJarFile(File projectDir, String jarfile) {
public static File findJarFile(File projectDir, String jarfile) {
File fp = new File(jarfile);
if (!fp.exists()) {
fp = new File(projectDir, jarfile);
@ -2966,17 +2830,16 @@ public class GUI extends Observable {
return fp.exists() ? fp : null;
}
private ClassLoader createClassLoader(ClassLoader parent,
Vector<File> projectDirs) throws ClassLoaderCreationException {
if (projectDirs == null || projectDirs.isEmpty()) {
private ClassLoader createClassLoader(ClassLoader parent, Collection<COOJAProject> projects)
throws ClassLoaderCreationException {
if (projects == null || projects.isEmpty()) {
return parent;
}
// Combine class loader from all project directories (including any
// specified JAR files)
/* Create class loader from JARs */
ArrayList<URL> urls = new ArrayList<URL>();
for (int j = projectDirs.size() - 1; j >= 0; j--) {
File projectDir = projectDirs.get(j);
for (COOJAProject project: projects) {
File projectDir = project.dir;
try {
urls.add((new File(projectDir, "java")).toURI().toURL());
@ -3394,9 +3257,9 @@ public class GUI extends Observable {
Element root = new Element("simconf");
/* Store project directories meta data */
for (File project: currentProjectDirs) {
for (COOJAProject project: currentProjects) {
Element projectElement = new Element("project");
projectElement.addContent(createPortablePath(project).getPath().replaceAll("\\\\", "/"));
projectElement.addContent(createPortablePath(project.dir).getPath().replaceAll("\\\\", "/"));
projectElement.setAttribute("EXPORT", "discard");
root.addContent(projectElement);
}
@ -3507,9 +3370,9 @@ public class GUI extends Observable {
}
boolean found = false;
for (File currentProject: currentProjectDirs) {
for (COOJAProject currentProject: currentProjects) {
if (projectFile.getPath().replaceAll("\\\\", "/").
equals(currentProject.getPath().replaceAll("\\\\", "/"))) {
equals(currentProject.dir.getPath().replaceAll("\\\\", "/"))) {
found = true;
break;
}
@ -3665,25 +3528,29 @@ public class GUI extends Observable {
}
public class ParseProjectsException extends Exception {
public ParseProjectsException(String message) {
private static final long serialVersionUID = 1508168026300714850L;
public ParseProjectsException(String message) {
super(message);
}
}
public class ClassLoaderCreationException extends Exception {
public ClassLoaderCreationException(String message) {
private static final long serialVersionUID = 1578001681266277774L;
public ClassLoaderCreationException(String message) {
super(message);
}
}
public class SimulationCreationException extends Exception {
public SimulationCreationException(String message) {
private static final long serialVersionUID = -2414899187405770448L;
public SimulationCreationException(String message) {
super(message);
}
}
public class PluginConstructionException extends Exception {
public PluginConstructionException(String message) {
private static final long serialVersionUID = 8004171223353676751L;
public PluginConstructionException(String message) {
super(message);
}
}
@ -3761,7 +3628,8 @@ public class GUI extends Observable {
if (retryAvailable) {
Action retryAction = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 2370456199250998435L;
public void actionPerformed(ActionEvent e) {
errorDialog.setTitle("-RETRY-");
errorDialog.dispose();
}
@ -3777,7 +3645,8 @@ public class GUI extends Observable {
}
AbstractAction closeAction = new AbstractAction(){
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 6225539435993362733L;
public void actionPerformed(ActionEvent e) {
errorDialog.dispose();
}
};
@ -3836,7 +3705,8 @@ public class GUI extends Observable {
/* Close on escape */
AbstractAction closeAction = new AbstractAction(){
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 2646163984382201634L;
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
};
@ -4235,7 +4105,8 @@ public class GUI extends Observable {
/* GUI actions */
abstract class GUIAction extends AbstractAction {
public GUIAction(String name) {
private static final long serialVersionUID = 6946179457635198477L;
public GUIAction(String name) {
super(name);
}
public GUIAction(String name, int nmenomic) {
@ -4253,7 +4124,8 @@ public class GUI extends Observable {
public abstract boolean shouldBeEnabled();
}
GUIAction newSimulationAction = new GUIAction("New simulation", KeyEvent.VK_N, KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)) {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 5053703908505299911L;
public void actionPerformed(ActionEvent e) {
myGUI.doCreateSimulation(true);
}
public boolean shouldBeEnabled() {
@ -4261,7 +4133,8 @@ public class GUI extends Observable {
}
};
GUIAction closeSimulationAction = new GUIAction("Close simulation", KeyEvent.VK_C) {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = -4783032948880161189L;
public void actionPerformed(ActionEvent e) {
myGUI.doRemoveSimulation(true);
}
public boolean shouldBeEnabled() {
@ -4269,7 +4142,8 @@ public class GUI extends Observable {
}
};
GUIAction reloadSimulationAction = new GUIAction("keep random seed", KeyEvent.VK_K, KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK)) {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 66579555555421977L;
public void actionPerformed(ActionEvent e) {
if (getSimulation() == null) {
/* Reload last opened simulation */
final File file = getLastOpenedFile();
@ -4290,7 +4164,8 @@ public class GUI extends Observable {
}
};
GUIAction reloadRandomSimulationAction = new GUIAction("new random seed", KeyEvent.VK_N, KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)) {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = -4494402222740250203L;
public void actionPerformed(ActionEvent e) {
/* Replace seed before reloading */
if (getSimulation() != null) {
getSimulation().setRandomSeed(getSimulation().getRandomSeed()+1);
@ -4302,7 +4177,8 @@ public class GUI extends Observable {
}
};
GUIAction saveSimulationAction = new GUIAction("Save simulation", KeyEvent.VK_S) {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 1132582220401954286L;
public void actionPerformed(ActionEvent e) {
myGUI.doSaveConfig(true);
}
public boolean shouldBeEnabled() {
@ -4313,7 +4189,8 @@ public class GUI extends Observable {
}
};
GUIAction closePluginsAction = new GUIAction("Close all plugins") {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = -37575622808266989L;
public void actionPerformed(ActionEvent e) {
Object[] plugins = startedPlugins.toArray();
for (Object plugin : plugins) {
removePlugin((Plugin) plugin, false);
@ -4324,7 +4201,8 @@ public class GUI extends Observable {
}
};
GUIAction exportExecutableJARAction = new GUIAction("Export simulation as executable JAR") {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = -203601967460630049L;
public void actionPerformed(ActionEvent e) {
getSimulation().stopSimulation();
/* Info message */
@ -4400,7 +4278,8 @@ public class GUI extends Observable {
}
};
GUIAction exitCoojaAction = new GUIAction("Exit", KeyEvent.VK_X, KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK)) {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 7523822251658687665L;
public void actionPerformed(ActionEvent e) {
myGUI.doQuit(true);
}
public boolean shouldBeEnabled() {
@ -4411,7 +4290,8 @@ public class GUI extends Observable {
}
};
GUIAction startStopSimulationAction = new GUIAction("Start/Stop simulation", KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)) {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 6750107157493939710L;
public void actionPerformed(ActionEvent e) {
/* Start/Stop current simulation */
Simulation s = getSimulation();
if (s == null) {
@ -4438,7 +4318,8 @@ public class GUI extends Observable {
}
};
class StartPluginGUIAction extends GUIAction {
public StartPluginGUIAction(String name) {
private static final long serialVersionUID = 7368495576372376196L;
public StartPluginGUIAction(String name) {
super(name);
}
public void actionPerformed(final ActionEvent e) {
@ -4456,7 +4337,8 @@ public class GUI extends Observable {
}
}
GUIAction removeAllMotesAction = new GUIAction("Remove all motes") {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 4709776747913364419L;
public void actionPerformed(ActionEvent e) {
Simulation s = getSimulation();
if (s.isRunning()) {
s.stopSimulation();
@ -4472,7 +4354,8 @@ public class GUI extends Observable {
}
};
GUIAction showQuickHelpAction = new GUIAction("Quick help", KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)) {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 3151729036597971681L;
public void actionPerformed(ActionEvent e) {
if (!(e.getSource() instanceof JCheckBoxMenuItem)) {
return;
}
@ -4488,7 +4371,8 @@ public class GUI extends Observable {
}
};
GUIAction showKeyboardShortcutsAction = new GUIAction("Keyboard shortcuts") {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 2382848024856978524L;
public void actionPerformed(ActionEvent e) {
loadQuickHelp("KEYBOARD_SHORTCUTS");
JCheckBoxMenuItem checkBox = ((JCheckBoxMenuItem)showQuickHelpAction.getValue("checkbox"));
if (checkBox == null) {
@ -4505,7 +4389,8 @@ public class GUI extends Observable {
}
};
GUIAction showBufferSettingsAction = new GUIAction("Buffer sizes") {
public void actionPerformed(ActionEvent e) {
private static final long serialVersionUID = 7018661735211901837L;
public void actionPerformed(ActionEvent e) {
if (mySimulation == null) {
return;
}