开发者

Best way to create new multi file wizard plugin in Eclipse?

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 ?


  1. Create an extension of org.eclipse.ui.newWizards to create the wizard
  2. Use the class org.eclipse.swt.widgets.DirectoryDialog to let the user select a directory
  3. Use an text field to let the user input the ${name}
  4. Use java.io.* to copy the files to the specified directory (or use org.eclipse.core.resources if you want to copy to the workspace)
  5. Create an extension of org.eclipse.ui.perspectiveExtensions with newWizardShortcut to add the new wizard to the perspective you want to extend
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜