putValue(GUIUtilities.MNEMONIC_KEY, Integer.valueOf(KeyEvent.VK_E));
}
public void actionPerformed(ActionEvent e) {
Configuration configuration = getConfiguration();
PtolemyPreferences preferences = null;
try {
preferences = (PtolemyPreferences) configuration.getAttribute(
PtolemyPreferences.PREFERENCES_WITHIN_CONFIGURATION,
PtolemyPreferences.class);
} catch (IllegalActionException ex) {
MessageHandler.error("Preferences attribute found, "
+ "but not of the right class.", ex);
}
if (preferences == null) {
MessageHandler
.message("No preferences given in the configuration.");
} else {
// Open a modal dialog to edit the parameters.
new EditParametersDialog(BasicGraphFrame.this, preferences,
"Edit Ptolemy Preferences");
// Make the current global variables conform with the
// new values.
try {
preferences.setAsDefault();
} catch (IllegalActionException ex) {
MessageHandler.error("Invalid expression.", ex);
actionPerformed(e);
}
// If any parameter has changed, all open vergil
// windows need to be notified.
Iterator frames = _openGraphFrames.iterator();
while (frames.hasNext()) {
BasicGraphFrame frame = (BasicGraphFrame) frames.next();
GraphModel graphModel = frame._getGraphController()
.getGraphModel();
graphModel
.dispatchGraphEvent(new GraphEvent(this,
GraphEvent.STRUCTURE_CHANGED, graphModel
.getRoot()));
if (frame._graphPanner != null) {
frame._graphPanner.repaint();
}
}
// Make the changes persistent.
try {
preferences.save();
} catch (IOException ex) {
try {
MessageHandler.warning("Failed to save preferences.",
ex);
} catch (CancelException e1) {