import java.util.regex.Pattern;\r
import java.util.regex.PatternSyntaxException;\r
\r
+import org.eclipse.core.resources.IFile;\r
import org.eclipse.core.resources.IMarker;\r
import org.eclipse.core.resources.IResource;\r
import org.eclipse.core.runtime.CoreException;\r
\r
// Bookmark map <Rank, MarkerId>\r
protected Map<Long, Long> fBookmarksMap = new HashMap<Long, Long>();\r
- protected IResource fBookmarksResource;\r
+ protected IFile fBookmarksFile;\r
protected long fPendingGotoRank = -1;\r
\r
// SWT resources\r
if (point.x <= imageBounds.x + imageBounds.width) {\r
// Right-click on left margin\r
Long rank = (Long) item.getData(Key.RANK);\r
- if (rank != null && fBookmarksResource != null) {\r
+ if (rank != null && fBookmarksFile != null) {\r
if (fBookmarksMap.containsKey(rank)) {\r
tablePopupMenu.add(new ToggleBookmarkAction(\r
Messages.TmfEventsTable_RemoveBookmarkActionText, rank));\r
if (markerId != null) {\r
bookmark = true;\r
try {\r
- IMarker marker = fBookmarksResource.findMarker(markerId);\r
+ IMarker marker = fBookmarksFile.findMarker(markerId);\r
item.setData(Key.BOOKMARK, marker.getAttribute(IMarker.MESSAGE));\r
} catch (CoreException e) {\r
displayException(e);\r
// Bookmark handling\r
// ------------------------------------------------------------------------\r
\r
- public void addBookmark(IResource resource) {\r
- fBookmarksResource = resource;\r
+ public void addBookmark(IFile bookmarksFile) {\r
+ fBookmarksFile = bookmarksFile;\r
TableItem[] selection = fTable.getSelection();\r
if (selection.length > 0) {\r
TableItem tableItem = selection[0];\r
if (dialog.open() == Dialog.OK) {\r
String message = dialog.getValue();\r
try {\r
- IMarker bookmark = resource.createMarker(IMarker.BOOKMARK);\r
+ IMarker bookmark = bookmarksFile.createMarker(IMarker.BOOKMARK);\r
if (bookmark.exists()) {\r
bookmark.setAttribute(IMarker.MESSAGE, message.toString());\r
long rank = (Long) tableItem.getData(Key.RANK);\r
}\r
\r
private void toggleBookmark(long rank) {\r
- if (fBookmarksResource == null) {\r
+ if (fBookmarksFile == null) {\r
return;\r
}\r
if (fBookmarksMap.containsKey(rank)) {\r
Long markerId = fBookmarksMap.remove(rank);\r
fTable.refresh();\r
try {\r
- IMarker bookmark = fBookmarksResource.findMarker(markerId);\r
+ IMarker bookmark = fBookmarksFile.findMarker(markerId);\r
if (bookmark != null) {\r
bookmark.delete();\r
}\r
displayException(e);\r
}\r
} else {\r
- addBookmark(fBookmarksResource);\r
+ addBookmark(fBookmarksFile);\r
}\r
}\r
\r
- public void refreshBookmarks(IResource resource) {\r
- fBookmarksResource = resource;\r
+ public void refreshBookmarks(IFile bookmarksFile) {\r
+ fBookmarksFile = bookmarksFile;\r
try {\r
fBookmarksMap.clear();\r
- for (IMarker bookmark : resource.findMarkers(IMarker.BOOKMARK, false, IResource.DEPTH_ZERO)) {\r
+ for (IMarker bookmark : bookmarksFile.findMarkers(IMarker.BOOKMARK, false, IResource.DEPTH_ZERO)) {\r
int location = bookmark.getAttribute(IMarker.LOCATION, -1);\r
if (location != -1) {\r
long rank = location;\r