Bug 152539
Usability: Hot code replace failed dialog is a little panic-inducing
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties
index 175e5f1..6c0e61e 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties
@@ -63,7 +63,7 @@
JavaStepFilterPreferencePage_Deselects_all_step_filters_4=Deselects all step filters
JDIDebugUIPlugin__0__contains_obsolete_methods_1={0} contains obsolete methods.
-JDIDebugUIPlugin__0__was_unable_to_replace_the_running_code_with_the_code_in_the_workspace__2={0} was unable to replace the running code with the code in the workspace.
+JDIDebugUIPlugin__0__was_unable_to_replace_the_running_code_with_the_code_in_the_workspace__2=Some code changes cannot be hot swapped into the target virtual machine, such as changing method names or introducing errors into running code.\n\nThe current target virtual machine [{0}] was unable to replace the running code with the code in the workspace.\n\nIt is safe to continue running the application, but you may notice discrepancies when debugging this application.
JDIDebugUIPlugin_1=Do not show error &when hot code replace fails
JDIDebugUIPlugin_4=Information
JDIDebugUIPlugin_2=Do not show error &when obsolete methods remain
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaHotCodeReplaceListener.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaHotCodeReplaceListener.java
index 39c4922..dbe7d4e 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaHotCodeReplaceListener.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaHotCodeReplaceListener.java
@@ -56,22 +56,29 @@
if (display.isDisposed()) {
return;
}
- final String vmName= fLabelProvider.getText(target);
+
+ String name = null;
+ try {
+ name = target.getName();
+ }
+ catch(DebugException e) {
+ name = fLabelProvider.getText(target);
+ }
+ final String vmName = name;
final IStatus status;
final String preference;
final String alertMessage;
if (exception == null) {
- status= new Status(IStatus.WARNING, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.WARNING, DebugUIMessages.JDIDebugUIPlugin_The_target_VM_does_not_support_hot_code_replace_1, null);
+ status = new Status(IStatus.WARNING, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.WARNING, DebugUIMessages.JDIDebugUIPlugin_The_target_VM_does_not_support_hot_code_replace_1, null);
preference= IJDIPreferencesConstants.PREF_ALERT_HCR_NOT_SUPPORTED;
alertMessage= DebugUIMessages.JDIDebugUIPlugin_3;
} else {
- status= exception.getStatus();
+ status = new Status(IStatus.WARNING, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.WARNING, exception.getMessage(), exception.getCause());
preference= IJDIPreferencesConstants.PREF_ALERT_HCR_FAILED;
alertMessage= DebugUIMessages.JDIDebugUIPlugin_1;
}
- final String title= DebugUIMessages.JDIDebugUIPlugin_Hot_code_replace_failed_1;
- final String message= MessageFormat.format(DebugUIMessages.JDIDebugUIPlugin__0__was_unable_to_replace_the_running_code_with_the_code_in_the_workspace__2,
- new Object[] {vmName});
+ final String title = DebugUIMessages.JDIDebugUIPlugin_Hot_code_replace_failed_1;
+ final String message = MessageFormat.format(DebugUIMessages.JDIDebugUIPlugin__0__was_unable_to_replace_the_running_code_with_the_code_in_the_workspace__2, new Object[] {vmName});
display.asyncExec(new Runnable() {
public void run() {
if (display.isDisposed()) {
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/JavaHotCodeReplaceManager.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/JavaHotCodeReplaceManager.java
index bdaf114..e0257b0 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/JavaHotCodeReplaceManager.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/JavaHotCodeReplaceManager.java
@@ -11,7 +11,6 @@
package org.eclipse.jdt.internal.debug.core.hcr;
-import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -74,6 +73,7 @@
import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
import org.eclipse.jdt.internal.debug.core.model.JDIThread;
+import com.ibm.icu.text.MessageFormat;
import com.sun.jdi.IncompatibleThreadStateException;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.VirtualMachine;