Problem with IFileEditorInput [message #165698] |
Wed, 26 January 2005 16:23 |
Eclipse User |
|
|
|
Originally posted by: ass4.alu.um.es
I am developing a graphical editor with GEF. I try to save the contents of
the diagram to a file in the doSave() method:
public void doSave(IProgressMonitor monitor)
{
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream outStream = new ObjectOutputStream(out);
outStream.writeObject(content);
outStream.close();
IFile file = ((IFileEditorInput)getEditorInput()).getFile();
file.setContents(new ByteArrayInputStream(out.toByteArray()),
true, false, monitor);
out.close();
getCommandStack().markSaveLocation();
}
catch (Exception e) {
e.printStackTrace();
}
}
But, when the line IFile file =
((IFileEditorInput)getEditorInput()).getFile(); is executed I receive a
ClassCastException in that line. I donŽt know why because I have in the
class path the ide.jar (this is the file in which IFileEditorInput.class
is in).
Please, could anybody tell me how I can to solve this problem?
|
|
|
|
Powered by
FUDForum. Page generated in 0.02591 seconds