Reputation: 1152
Is there a way to create a file with specific extension. Currently im creating a html kind file. Is there a way to give specific extension to the file while creating? Maybe .css or .js etc?
<extension
point="org.eclipse.ui.newWizards">
<category id="com.ui.category" name="XXX Project">
</category>
<wizard
category="com.ui.category"
id="ui.wizard.NewFileWizard"
name="Create a new File"
icon="icons/new_project.png"
class="org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard"
project="true"
>
</wizard>
</extension>
Upvotes: 0
Views: 45
Reputation: 111142
You will have to create your own wizard to do this, extending BasicNewFileResourceWizard
The minimum code would be something like this:
public class FileExtNewFileWizard extends BasicNewFileResourceWizard
{
public FileExtNewFileWizard()
{
super();
}
@Override
public void addPages()
{
super.addPages();
// Get the page created by `super.addPages` and set the default file extension
WizardNewFileCreationPage page = (WizardNewFileCreationPage)getPage("newFilePage1");
page.setFileExtension("css");
}
}
Upvotes: 1