Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2013-09-11 02:44:05 -0400
committerAnton Leherbauer2013-09-11 03:21:27 -0400
commitbe402eb29b0bf45b6f7e05168139efa1836c4ad7 (patch)
treeb6a5d047ca6cb7b31d7511732fa3c605f1c4b36d /plugins
parent1e3439fa5345ca38c5bd6e2ead9c13c4d4ab2ac7 (diff)
downloadorg.eclipse.tcf-be402eb29b0bf45b6f7e05168139efa1836c4ad7.tar.gz
org.eclipse.tcf-be402eb29b0bf45b6f7e05168139efa1836c4ad7.tar.xz
org.eclipse.tcf-be402eb29b0bf45b6f7e05168139efa1836c4ad7.zip
TCF Debug: Bug 416849 - Run to line, Move to line, etc. not visible in
editor context menu
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/EvaluationContextManager.java34
1 files changed, 32 insertions, 2 deletions
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/EvaluationContextManager.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/EvaluationContextManager.java
index ed20345c9..130d71527 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/EvaluationContextManager.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/EvaluationContextManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 QNX Software Systems and others.
+ * Copyright (c) 2004, 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,11 +13,16 @@
*******************************************************************************/
package org.eclipse.tcf.internal.cdt.ui;
+import org.eclipse.cdt.debug.core.model.IMoveToLine;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.dsf.debug.ui.DsfDebugUITools;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
@@ -52,6 +57,9 @@ public class EvaluationContextManager implements IWindowListener, IDebugContextL
}
public static void startup() {
+ // Bug 416849: trigger lazy activation of 'org.eclipse.cdt.dsf.ui' and 'org.eclipse.cdt.debug.ui'
+ DsfDebugUITools.getPreferenceStore();
+ CDebugUIPlugin.getDefault();
WorkbenchJob job = new WorkbenchJob("") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
@@ -69,7 +77,7 @@ public class EvaluationContextManager implements IWindowListener, IDebugContextL
};
job.setPriority(Job.SHORT);
job.setSystem(true);
- job.schedule();
+ job.schedule(100);
}
@@ -122,10 +130,32 @@ public class EvaluationContextManager implements IWindowListener, IDebugContextL
System.setProperty(DEBUGGER_ACTIVE, Boolean.toString(true));
return;
}
+ // Test for other CDT-based debuggers
+ ISuspendResume sr = adapt(element, ISuspendResume.class);
+ IMoveToLine mtl = adapt(sr, IMoveToLine.class);
+ if (mtl != null) {
+ // debugger supports move-to-line, don't interfere with it
+ return;
+ }
}
}
// no context in the given view
System.setProperty(DEBUGGER_ACTIVE, Boolean.toString(false));
}
+
+ @SuppressWarnings("unchecked")
+ private <T> T adapt(Object adaptable, Class<T> clazz) {
+ if (adaptable == null)
+ return null;
+ if (clazz.isInstance(adaptable))
+ return (T) adaptable;
+ T adapter = null;
+ if (adaptable instanceof IAdaptable)
+ adapter = (T) ((IAdaptable) adaptable).getAdapter(clazz);
+ if (adapter == null)
+ adapter = (T) Platform.getAdapterManager().loadAdapter(adaptable, clazz.getName());
+ return adapter;
+ }
+
}

Back to the top