- public boolean hasSupplementaryFiles() {
- // Check for all supplementary files
- for (int i = 0; i < SUPPLEMENATARY_FILES_EXTENSIONS.length; i++) {
- IFile supplFile = createSupplemenatryFile(fResource.getName(), SUPPLEMENATARY_FILES_EXTENSIONS[i]);
-
- if (supplFile.exists()) {
- return true;
- }
- }
- return false;
- }
-
- public void deleteSupplementaryFiles() {
- // Delete all supplementary files
- for (int i = 0; i < SUPPLEMENATARY_FILES_EXTENSIONS.length; i++) {
- IFile supplFile = createSupplemenatryFile(fResource.getName(), SUPPLEMENATARY_FILES_EXTENSIONS[i]);
- if (supplFile.exists()) {
- try {
- supplFile.delete(true, new NullProgressMonitor());
- } catch (CoreException e) {
- TmfUiPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, TmfUiPlugin.PLUGIN_ID, "Error deleting resource supplementary file " + supplFile, e)); //$NON-NLS-1$
+ /**
+ * Returns the file resource used to store bookmarks after creating it if
+ * necessary. If the trace resource is a file, it is returned directly. If
+ * the trace resource is a folder, a linked file is returned. The file will
+ * be created if it does not exist.
+ *
+ * @return the bookmarks file
+ * @throws CoreException
+ * if the bookmarks file cannot be created
+ * @since 2.0
+ */
+ public IFile createBookmarksFile() throws CoreException {
+ IFile file = getBookmarksFile();
+ if (fResource instanceof IFolder) {
+ if (!file.exists()) {
+ final IFile bookmarksFile = getProject().getTracesFolder().getResource().getFile(BOOKMARKS_HIDDEN_FILE);
+ if (!bookmarksFile.exists()) {
+ final InputStream source = new ByteArrayInputStream(new byte[0]);
+ bookmarksFile.create(source, true, null);