import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.swt.events.MenuDetectEvent;
import org.eclipse.swt.events.MenuDetectListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.analysis.os.linux.core.signals.TmfCpuSelectedSignal;
import org.eclipse.tracecompass.analysis.os.linux.ui.views.resources.ResourcesEntry.Type;
import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Messages;
final TimeGraphViewer timeGraphViewer = getTimeGraphViewer();
Menu menu = fMenuMgr.createContextMenu(timeGraphViewer.getTimeGraphControl());
timeGraphViewer.getTimeGraphControl().setMenu(menu);
- getTimeGraphViewer().getTimeGraphControl().addMenuDetectListener(new MenuDetectListener() {
+ getTimeGraphViewer().getTimeGraphControl().addTimeGraphEntryMenuListener(new MenuDetectListener() {
@Override
public void menuDetected(MenuDetectEvent event) {
fMenuMgr.removeAll();
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
import org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo;
import org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentSignal;
if (null == fTimeProvider) {
return;
}
+ Point p = toControl(e.x, e.y);
if (e.detail == SWT.MENU_MOUSE) {
if (fPendingMenuDetectEvent == null) {
/* Feature in Linux. The MenuDetectEvent is received before mouseDown.
* This allows for the method to detect if mouse is used to drag zoom.
*/
fPendingMenuDetectEvent = e;
+ /*
+ * Prevent the platform to show the menu when returning. The
+ * menu will be shown (see below) when this method is called
+ * again during mouseup().
+ */
+ e.doit = false;
return;
}
fPendingMenuDetectEvent = null;
- if (fDragState != DRAG_ZOOM || fDragX != fDragX0) {
+ if ((p.x >= fTimeProvider.getNameSpace()) && (fDragState != DRAG_ZOOM || fDragX != fDragX0)) {
return;
}
} else {
return;
}
}
- Point p = toControl(e.x, e.y);
int idx = getItemIndexAtY(p.y);
if (idx >= 0 && idx < fItemData.fExpandedItems.length) {
+ e.doit = true;
Item item = fItemData.fExpandedItems[idx];
ITimeGraphEntry entry = item.fEntry;
if (entry.hasTimeEvents()) {
if (event != null) {
e.data = event;
fireMenuEventOnTimeEvent(e);
+ Menu menu = getMenu();
+ if (e.doit && (menu != null)) {
+ menu.setVisible(true);
+ }
return;
}
}
e.data = entry;
fireMenuEventOnTimeGraphEntry(e);
+ Menu menu = getMenu();
+ if (e.doit && (menu != null)) {
+ menu.setVisible(true);
+ }
}
}