}
}
@Override
public boolean performFinish() {
IFile target = _modulePage.getTargetFile();
String header = Plugin.getDefault().getHeaderFileMap().get(_fileExtToHeader.get(target.getFileExtension())).getHeaderForProject(target.getProject());
if (_modulePage.getCopyFromFile() != null) {
try {
target.create(new ByteArrayInputStream((header + "\n").getBytes()), true, new NullProgressMonitor());
target.appendContents(Plugin.getDefault().getResourceAsStream(_modulePage.getCopyFromFile()), true, false, new NullProgressMonitor());
} catch (CoreException e) {
Plugin.getDefault().logError("Unable to create file " + target.getLocation(), e);
return false;
} catch (IOException e) {
Plugin.getDefault().logError("Unable to cpoy from template in file " + target.getLocation(), e);
return false;
}
}else{
try {
target.create(new ByteArrayInputStream(header.getBytes()), true, new NullProgressMonitor());
} catch (CoreException e) {
Plugin.getDefault().logError("Unable to create file " + target.getLocation(), e);
return false;
}
}
try {
if(target.getFileExtension().equals("tmlscript") || target.getFileExtension().equals("js") ){
WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), target, ResourceIDs.EDITOR_TMLSCRIPT);
}else{
WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), target, EditorsUI.DEFAULT_TEXT_EDITOR_ID);
}
} catch (PartInitException e) {
Plugin.getDefault().logWarning("Unable to open editor for file " + target.getLocation(), e);
}
return true;
}