I 开发者_StackOverflowwant to create an eclipse plugin which appears in the "new" menu like "new class" (for example "new MyStructure").
The goal of this plugin is to ask a name and a folder where to place the generated content.
The generated content is created by copying an existing standard directory like the following (${dir} represents the selected directory in the wizard and ${name} the name asked in the wizard) :
$dir
- ${name}.java
- css
- Default${name}Style.css
- ${name}Editor.java
- ${name}.config
each of this file is based on an existing file content, something like eclipse code template where I can specify dynamic ${name} and package.
How can I easily done this eclipse plugin ?
- Create an extension of
org.eclipse.ui.newWizards
to create the wizard - Use the class
org.eclipse.swt.widgets.DirectoryDialog
to let the user select a directory - Use an text field to let the user input the
${name}
- Use
java.io.*
to copy the files to the specified directory (or useorg.eclipse.core.resources
if you want to copy to the workspace) - Create an extension of
org.eclipse.ui.perspectiveExtensions
withnewWizardShortcut
to add the new wizard to the perspective you want to extend
精彩评论