*/
public void createEditor(NamedObj object, Frame parent) {
ComponentDialog dialog = null;
FileParameter helpFileParameter = (FileParameter) object
.getAttribute("help");
String[] buttons = _moreButtons;
if (helpFileParameter == null) {
// Do not include the help button.
buttons = _moreButtonsNoHelp;
}
dialog = new ComponentDialog(parent, "Edit Parameters or File",
createEditorPane(), buttons);
String button = dialog.buttonPressed();
if (button.equals("Cancel")) {
return;
}
if (button.equals(_moreButtons[0])) {
new EditParametersDialog(parent, object);
return;
}
Configuration configuration = (Configuration) Configuration.findEffigy(
object.getContainer()).toplevel();
if (button.equals(_moreButtons[1])) {
FileParameter fileOrURLParameter = (FileParameter) object
.getAttribute("fileOrURL");
if (fileOrURLParameter == null) {
throw new InternalErrorException(object, null,
"No \"fileOrURL\" attribute.");
} else {
try {
if (fileOrURLParameter.asURL() == null) {
ModelDirectory directory = configuration.getDirectory();
StringParameter initialDefaultContentsParameter = (StringParameter) object
.getAttribute("initialDefaultContents");
String defaultText = "";
if (initialDefaultContentsParameter != null) {
defaultText = initialDefaultContentsParameter
.getExpression();
}
Effigy effigy = TextEffigy.newTextEffigy(directory,
defaultText);
configuration.createPrimaryTableau(effigy);
// EffigyFactory textEffigyFactory = new TextEffigy.Factory(directory, "effigyFactory");
// Tableau tableau = configuration.openModel(
// null, null, "Unnamed",
// textEffigyFactory);
// Effigy effigy = (Effigy) tableau.getContainer();
// effigy.masterEffigy().setModifiable(true);
// System.out.println("FileOrURLEditorFactory: modifiable"
// + effigy.isModifiable() + " " + effigy);
} else {
URL fileURL = fileOrURLParameter.asFile().toURI()
.toURL();
configuration.openModel(null, fileURL, fileURL
.toExternalForm());
}
} catch (Exception ex) {