[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] File creation

Hello!

I am a little bit confused how to create a new file in Eclipse. I know that there is the NewFileCreation wizard which can be used to create own files and I already used it to create a special file. These files can be edited with a special editor. This editor adds an action to the EditorContribution bar. If this action is invoked, new java files should bed created from the information specified in the editor. My problem is you to find out the current Path of the project, how to use the IFile interface to create files....

To sumerize my problem up:

1) I have got the name of the file that should be created as a simple string, for example "MyJavaFile.java" and eventually a package name as string too.

2) I want to check if the current project has the package, if the user has specified one, if it does not exist, I want to create the package too.

3) The new file sould be created in the current project in the specified package (if none is specifed it sould be placed in the default package)

4) eventually refresh the navigator view (if necessary to show the new file)

thx in advance

Hannes