private Action fPreviousMarkerAction;
private MenuManager fMarkersMenu;
+ /** Pin related state */
+ private boolean fMarkersUpdateEnabled = true;
+ private boolean fShowMarkerActionsEnabled = true;
+
/** The list of bookmarks */
- private final List<IMarkerEvent> fBookmarks = new ArrayList<>();
+ private final List<IMarkerEvent> fCurrentBookmark = new ArrayList<>();
+ private final List<IMarkerEvent> fSyncedBookmark = new ArrayList<>();
/** The list of marker categories */
private final List<String> fMarkerCategories = new ArrayList<>();
* @since 2.0
*/
public void setBookmarks(List<IMarkerEvent> bookmarks) {
- fBookmarks.clear();
+
+ fSyncedBookmark.clear();
+
if (bookmarks != null) {
- fBookmarks.addAll(bookmarks);
+ fSyncedBookmark.addAll(bookmarks);
+ }
+
+ if (fMarkersUpdateEnabled) {
+ fCurrentBookmark.clear();
+ fCurrentBookmark.addAll(fSyncedBookmark);
}
updateMarkerList();
updateMarkerActions();
* @since 2.0
*/
public List<IMarkerEvent> getBookmarks() {
- return Collections.unmodifiableList(fBookmarks);
+ return Collections.unmodifiableList(fCurrentBookmark);
}
/**
final String label = dialog.getValue();
final RGBA rgba = dialog.getColorValue();
IMarkerEvent bookmark = new MarkerEvent(null, time, duration, IMarkerEvent.BOOKMARKS, rgba, label, true);
- fBookmarks.add(bookmark);
+ fCurrentBookmark.add(bookmark);
updateMarkerList();
updateMarkerActions();
getControl().redraw();
fireBookmarkAdded(bookmark);
}
} else {
- fBookmarks.remove(selectedBookmark);
+ fCurrentBookmark.remove(selectedBookmark);
updateMarkerList();
updateMarkerActions();
getControl().redraw();
private IMarkerEvent getBookmarkAtSelection() {
final long time = Math.min(fSelectionBegin, fSelectionEnd);
final long duration = Math.max(fSelectionBegin, fSelectionEnd) - time;
- for (IMarkerEvent bookmark : fBookmarks) {
+ for (IMarkerEvent bookmark : fCurrentBookmark) {
if (bookmark.getTime() == time && bookmark.getDuration() == duration) {
return bookmark;
}
}
private void updateMarkerActions() {
- boolean enabled = fTime0Bound != SWT.DEFAULT || fTime1Bound != SWT.DEFAULT;
+ boolean enabled = (fTime0Bound != SWT.DEFAULT || fTime1Bound != SWT.DEFAULT) && fShowMarkerActionsEnabled;
if (fToggleBookmarkAction != null) {
if (getBookmarkAtSelection() != null) {
fToggleBookmarkAction.setText(Messages.TmfTimeGraphViewer_BookmarkActionRemoveText);
}
}
if (!fHiddenMarkerCategories.contains(IMarkerEvent.BOOKMARKS)) {
- markers.addAll(fBookmarks);
+ markers.addAll(fCurrentBookmark);
}
Collections.sort(markers, new MarkerComparator());
fTimeGraphCtrl.setMarkers(markers);
fTimeAlignedComposite.layout();
}
+ @Override
+ public synchronized void setPinned(boolean pinned) {
+ super.setPinned(pinned);
+ boolean enabled = !pinned;
+
+ fTimeGraphCtrl.setPinned(pinned);
+ fTimeScaleCtrl.setPinned(pinned);
+ fMarkerAxisCtrl.setPinned(pinned);
+
+ fHorizontalScrollBar.setEnabled(enabled);
+ fHorizontalScrollBar.setVisible(enabled);
+
+ fMouseWheelListeners.setHorizontalScrollEnabled(enabled);
+ fMouseWheelListeners.setZoomEnabled(enabled);
+
+ fKeyListeners.setAllEnabled(enabled);
+
+ fMarkersMenu.setVisible(enabled);
+
+ if (enabled) {
+ fCurrentBookmark.clear();
+ fCurrentBookmark.addAll(fSyncedBookmark);
+ }
+
+ if (fResetScaleAction != null) {
+ fResetScaleAction.setEnabled(enabled);
+ }
+ if (fShowLegendAction != null) {
+ fShowLegendAction.setEnabled(enabled);
+ }
+ if (fNextEventAction != null) {
+ fNextEventAction.setEnabled(enabled);
+ }
+ if (fPrevEventAction != null) {
+ fPrevEventAction.setEnabled(enabled);
+ }
+ if (fNextItemAction != null) {
+ fNextItemAction.setEnabled(enabled);
+ }
+ if (fPreviousItemAction != null) {
+ fPreviousItemAction.setEnabled(enabled);
+ }
+ if (fZoomInAction != null) {
+ fZoomInAction.setEnabled(enabled);
+ }
+ if (fZoomOutAction != null) {
+ fZoomOutAction.setEnabled(enabled);
+ }
+ if (fHideArrowsAction != null) {
+ fHideArrowsAction.setEnabled(enabled);
+ }
+ if (fFollowArrowFwdAction != null) {
+ fFollowArrowFwdAction.setEnabled(enabled);
+ }
+ if (fFollowArrowBwdAction != null) {
+ fFollowArrowBwdAction.setEnabled(enabled);
+ }
+ if (fShowFilterDialogAction != null) {
+ fShowFilterDialogAction.setEnabled(enabled);
+ }
+ if (fToggleBookmarkAction != null) {
+ fToggleBookmarkAction.setEnabled(enabled);
+ }
+
+ fShowMarkerActionsEnabled = enabled;
+ fMarkersUpdateEnabled = enabled;
+ updateMarkerActions();
+ }
+
}