GEF编辑器的文件如何实现保存功能。结合RCP做的。

  我用GEF框架,结合RCP技术做了一个编辑器,现在编辑的内容无法实现保存。
        保存涉及到的代码如下
        @Override
public void doSave(IProgressMonitor monitor) {
    System.out.println("CCML中的dosave方法开始执行   ");
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
        createOutputStream(out);        
        //从编辑器获得编辑文件
        IFile file = ((IFileEditorInput) getEditorInput()).getFile();
        file.setContents(
            new ByteArrayInputStream(out.toByteArray()), 
            true,  // keep saving, even if IFile is out of sync with the Workspace
            false, // dont keep history
            monitor); // progress monitor
        getCommandStack().markSaveLocation();
    } catch (CoreException ce) { 
        ce.printStackTrace();
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }   
}
private void createOutputStream(OutputStream os) throws IOException {
    //创建写入指定 OutputStream 的 ObjectOutputStream
    ObjectOutputStream oos = new ObjectOutputStream(os);
    oos.writeObject(getModel());
    oos.close();
}

麻烦大家知道的指点一二,谢谢。

ide
public void doSave(IProgressMonitor monitor) {
System.out.println("CCML中的dosave方法开始执行 ");
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
createOutputStream(out);

//从编辑器获得编辑文件
IFile file = ((IFileEditorInput) getEditorInput()).getFile();
file.setContents(
new ByteArrayInputStream(out.toByteArray()),
true, // keep saving, even if IFile is out of sync with the Workspace
false, // dont keep history
monitor); // progress monitor
getCommandStack().markSaveLocation();
} catch (CoreException ce) {
ce.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}

}
private void createOutputStream(OutputStream os) throws IOException {
//创建写入指定 OutputStream 的 ObjectOutputStream
ObjectOutputStream oos = new ObjectOutputStream(os);
oos.writeObject(getModel());
oos.close();