[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[pde-dev] creating files within a plugin
|
Hi folks,
I'm trying to create a file within a plugin, and then open it in a
editor using IWorkbenchPage.openEditor. I am currently trying to do it
the following way, but I receive a ResourceException at this(*) line. I
must be shooting myself in the foot somewhere, but I can't figure it
out. changeLogPlugin is an object that extends from AbstractUIPlugin,
hence the invocation of the ResourcesPlugin class. The other weird
thing I don't understand is that the missing resource is a directory
that does exist. I guess it's not being managed as a resource? Thanks!
IPath filePath = changeLogPlugin.getStateLocation();
filePath = filePath.append("/ChangeLog");
String foo = new String("foo");
IFile fileHandle =
ResourcesPlugin.getWorkspace().getRoot().getFile(filePath);
(*) fileHandle.create(new
ByteArrayInputStream(foo.getBytes()),true,null);
FileEditorInput fEditorInput = new FileEditorInput(fileHandle);
Stacktrace:
org.eclipse.core.internal.resources.ResourceException: Resource
/home/mspiegel/eclipse/runtime-workspace/.metadata/.plugins/net.sf.cvschangelog
does not exist.
at
org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:310)
at
org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:178)
at org.eclipse.core.internal.resources.File.create(File.java:109)
at org.eclipse.core.internal.resources.File.create(File.java:181)
at
net.sf.cvschangelog.view.ChangeLogDoubleClickListener.doubleClick(ChangeLogDoubleClickListener.java:54)
....
....etc, etc.
--Michael