}
public void apply(IDocument document) {
IResource resource = _markerAnnotation.getMarker().getResource();
if (resource instanceof IFile) {
IFile referer = (IFile) resource;
IFolder tmlFolder = new WGADesignStructureHelper(referer).getTmlRoot();
IFile fileToCreate = tmlFolder.getFile(new Path(_refPath));
if (!fileToCreate.exists()) {
try {
// mkdir
IContainer parent = fileToCreate.getParent();
List<IFolder> foldersToCreate = new ArrayList<IFolder>();
while (!parent.exists()) {
if (parent instanceof IFolder) {
foldersToCreate.add((IFolder)parent);
}
parent = parent.getParent();
}
for (int i=foldersToCreate.size() - 1; i >= 0; i--) {
foldersToCreate.get(i).create(false, true, new NullProgressMonitor());
}
// create tml file
String header = Plugin.getDefault().getHeaderFileMap().get(Plugin.HEADER_TML_MODUL).getHeaderForProject(fileToCreate.getProject());
fileToCreate.create(new ByteArrayInputStream(header.getBytes()), true, new NullProgressMonitor());
// open editor
WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), fileToCreate, ResourceIDs.EDITOR_TML);
} catch (CoreException e) {
}
}