|
128 | 128 | import org.eclipse.jdt.debug.tests.core.LiteralTests17; |
129 | 129 | import org.eclipse.jdt.debug.tests.refactoring.MemberParser; |
130 | 130 | import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants; |
| 131 | +import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin; |
131 | 132 | import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget; |
132 | 133 | import org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine; |
133 | 134 | import org.eclipse.jdt.internal.debug.ui.BreakpointUtils; |
134 | 135 | import org.eclipse.jdt.internal.debug.ui.IJDIPreferencesConstants; |
135 | 136 | import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; |
136 | 137 | import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; |
137 | 138 | import org.eclipse.jdt.launching.IVMInstall; |
| 139 | +import org.eclipse.jdt.launching.IVMInstallChangedListener; |
138 | 140 | import org.eclipse.jdt.launching.JavaRuntime; |
| 141 | +import org.eclipse.jdt.launching.PropertyChangeEvent; |
139 | 142 | import org.eclipse.jdt.launching.environments.IExecutionEnvironment; |
140 | 143 | import org.eclipse.jface.dialogs.ErrorDialog; |
141 | 144 | import org.eclipse.jface.dialogs.MessageDialogWithToggle; |
|
170 | 173 | @SuppressWarnings("deprecation") |
171 | 174 | public abstract class AbstractDebugTest extends TestCase implements IEvaluationListener { |
172 | 175 |
|
| 176 | + static { |
| 177 | + JavaRuntime.addVMInstallChangedListener(new LogVMInstallChanges()); |
| 178 | + } |
| 179 | + |
173 | 180 | public static final String MULTI_OUTPUT_PROJECT_NAME = "MultiOutput"; |
174 | 181 | public static final String BOUND_EE_PROJECT_NAME = "BoundEE"; |
175 | 182 | public static final String ONE_FOUR_PROJECT_NAME = "DebugTests"; |
@@ -3090,4 +3097,35 @@ private static String toString(Collection<IMarker> markers) { |
3090 | 3097 | public interface StackFrameSupplier { |
3091 | 3098 | IJavaStackFrame get() throws Exception; |
3092 | 3099 | } |
| 3100 | + |
| 3101 | + private static void logVMChange(String message, IVMInstall vm) { |
| 3102 | + IStatus status = new Status(IStatus.INFO, JDIDebugPlugin.getUniqueIdentifier(), |
| 3103 | + message + " " + vm.getName() + ", location: " + vm.getInstallLocation(), |
| 3104 | + new RuntimeException("strack trace info")); |
| 3105 | + JDIDebugPlugin.log(status); |
| 3106 | + } |
| 3107 | + |
| 3108 | + private static class LogVMInstallChanges implements IVMInstallChangedListener { |
| 3109 | + |
| 3110 | + @Override |
| 3111 | + public void vmRemoved(IVMInstall vm) { |
| 3112 | + logVMChange("VM removed", vm); |
| 3113 | + } |
| 3114 | + |
| 3115 | + @Override |
| 3116 | + public void vmChanged(PropertyChangeEvent event) { |
| 3117 | + } |
| 3118 | + |
| 3119 | + @Override |
| 3120 | + public void vmAdded(IVMInstall vm) { |
| 3121 | + logVMChange("VM added", vm); |
| 3122 | + |
| 3123 | + } |
| 3124 | + |
| 3125 | + @Override |
| 3126 | + public void defaultVMInstallChanged(IVMInstall previous, IVMInstall current) { |
| 3127 | + logVMChange("Default VM changed", current); |
| 3128 | + } |
| 3129 | + |
| 3130 | + } |
3093 | 3131 | } |
0 commit comments