18 package org.turro.zkoss.text;
21 import java.io.IOException;
22 import java.util.logging.Level;
23 import java.util.logging.Logger;
24 import org.amic.util.file.FileUtil;
25 import org.turro.command.Command;
26 import org.turro.command.Context;
27 import org.turro.elephant.context.ElephantContext;
28 import org.turro.i18n.I_;
29 import org.turro.menu.ElephantMenu;
30 import org.turro.zkoss.dialog.InputDialog;
31 import org.turro.zkoss.dialog.InputField;
32 import org.zkoss.lang.Strings;
33 import org.zkoss.zk.ui.ext.AfterCompose;
34 import org.zkoss.zul.Textbox;
40 public class FileEditor extends Textbox implements AfterCompose {
45 "@Editor: " +
file.getName(),
71 }
catch (IOException ex) {
76 public void saveAs() throws IOException {
81 new InputField(
"Name", getFile().getName(), null, 0)
84 public Object execute(Context context) {
86 if(fields.length > 0) {
88 if(
"Name".equals(f.getLabel())) {
89 String path =
FileUtil.getParentPath(
file.getAbsolutePath());
91 file =
new File(path +
"/" + f.getValue());
108 }
catch (IOException ex) {
static String logMsg(String msg)
static String getEncoding()
static void setContent(File file, String value)
static String getContent(File file)
static String get(String msg)
static void editFile(File file)
void setEncoding(String encoding)