Package workspace.wizards

Source Code of workspace.wizards.NewFile

package workspace.wizards;

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard;

import workspace.elements.CodeFile;

public class NewFile extends BasicNewFileResourceWizard
{
    public NewFile() {}

    @Override
    public void init(IWorkbench workbench, IStructuredSelection selection)
    {
        super.init(workbench, selection);
    }

    @Override
    public boolean performFinish()
    {
        WizardNewFileCreationPage page = ((WizardNewFileCreationPage)getPage("newFilePage1"));
        String fileName = page.getFileName();
        if (!fileName.endsWith(CodeFile.EXTENTION_WITH_DOT))
        {
            fileName += CodeFile.EXTENTION_WITH_DOT;
        }
        page.setFileName(fileName);
       
        return super.performFinish();
    }
}
TOP

Related Classes of workspace.wizards.NewFile

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.