1 /*******************************************************************************
2 * Copyright (c) 2010 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.timechart
;
15 import java
.util
.HashSet
;
18 import org
.eclipse
.core
.resources
.IMarker
;
19 import org
.eclipse
.core
.resources
.IResource
;
20 import org
.eclipse
.core
.runtime
.CoreException
;
21 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
22 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.ITmfFilter
;
24 public class TimeChartDecorationProvider
{
26 private IResource fResource
;
27 private Set
<Long
> fBookmarksSet
= new HashSet
<Long
>();
28 private ITmfFilter fFilterFilter
;
29 private ITmfFilter fSearchFilter
;
31 public TimeChartDecorationProvider(IResource resource
) {
36 public IResource
getResource() {
40 public boolean isBookmark(long rank
) {
41 return fBookmarksSet
.contains(rank
);
44 public void refreshBookmarks() {
46 fBookmarksSet
.clear();
47 for (IMarker bookmark
: fResource
.findMarkers(IMarker
.BOOKMARK
, false, IResource
.DEPTH_ZERO
)) {
48 int location
= bookmark
.getAttribute(IMarker
.LOCATION
, -1);
50 Long rank
= (long) location
;
51 fBookmarksSet
.add(rank
);
54 } catch (CoreException e
) {
59 public void filterApplied(ITmfFilter filter
) {
60 fFilterFilter
= filter
;
63 public boolean isVisible(ITmfEvent event
) {
64 if (fFilterFilter
!= null) {
65 return fFilterFilter
.matches(event
);
70 public void searchApplied(ITmfFilter filter
) {
71 fSearchFilter
= filter
;
74 public boolean isSearchMatch(ITmfEvent event
) {
75 if (fSearchFilter
!= null) {
76 return fSearchFilter
.matches(event
);