Bug 309759 - Dialog for adding JRE must not show warning at beginning
Change-Id: I4b9a3afcd06d59ce2d645308172ac26781bb55db
diff --git a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
index d2742d7..3c160ea 100644
--- a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.debug.ui; singleton:=true
-Bundle-Version: 3.10.700.qualifier
+Bundle-Version: 3.11.0.qualifier
Bundle-Activator: org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.debug.ui/pom.xml b/org.eclipse.jdt.debug.ui/pom.xml
index d732ea9..3d33a98 100644
--- a/org.eclipse.jdt.debug.ui/pom.xml
+++ b/org.eclipse.jdt.debug.ui/pom.xml
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.debug.ui</artifactId>
- <version>3.10.700-SNAPSHOT</version>
+ <version>3.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<code.ignoredWarnings>-warn:+resource,-deprecation,unavoidableGenericProblems</code.ignoredWarnings>
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/AbstractVMInstallPage.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/AbstractVMInstallPage.java
index 94fda72..0ef2b92 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/AbstractVMInstallPage.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/AbstractVMInstallPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2019 IBM Corporation and others.
+ * Copyright (c) 2007, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -118,14 +118,35 @@
}
/**
- * Updates the name status based on the new name. This method should be called
- * by the page each time the VM name changes.
+ * Updates the name status based on the new name. This method should be called by the page each time the VM name changes.
*
- * @param newName new name of VM
+ * Use nameChanged(String newName, boolean init)
+ *
+ * @param newName
+ * new name of VM
+ *
*/
+ @Deprecated
protected void nameChanged(String newName) {
+ nameChanged(newName, false);
+ }
+
+ /**
+ * Updates the name status based on the new name. This method should be called by the page each time the VM name changes.
+ *
+ * @param newName
+ * new name of VM
+ * @param init
+ * <code>true</code> if page is getting initialized else <code>false</code>
+ *
+ * @since 3.11
+ */
+ protected void nameChanged(String newName, boolean init) {
fNameStatus = Status.OK_STATUS;
if (newName == null || newName.trim().length() == 0) {
+ if (init) {
+ return;
+ }
int sev = IStatus.ERROR;
if (fOriginalName == null || fOriginalName.length() == 0) {
sev = IStatus.WARNING;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/EEVMPage.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/EEVMPage.java
index c5c41b7..614eb2f 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/EEVMPage.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/EEVMPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2018 IBM Corporation and others.
+ * Copyright (c) 2007, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -132,7 +132,7 @@
@Override
public void modifyText(ModifyEvent e) {
if (!fIgnoreCallbacks) {
- validateVMName();
+ validateVMName(false);
}
}
});
@@ -228,8 +228,8 @@
/**
* Validates the entered name of the VM
*/
- private void validateVMName() {
- nameChanged(fVMName.getText());
+ private void validateVMName(boolean init) {
+ nameChanged(fVMName.getText(), init);
}
/* (non-Javadoc)
@@ -309,8 +309,15 @@
try {
fIgnoreCallbacks = true;
fLibraryBlock.setSelection(fVM);
- fVMName.setText(fVM.getName());
- fVMName.setSelection(fVM.getName().length());
+ if (fVMName.getText() != null && fVMName.getText().length() == 0) {
+ if (fVM.getName().length() != 0) {
+ fVMName.setText(fVM.getName());
+ fVMName.setSelection(fVM.getName().length());
+ }
+ } else {
+ fVMName.setText(fVM.getName());
+ fVMName.setSelection(fVM.getName().length());
+ }
String eePath = fVM.getAttribute(EEVMInstall.ATTR_DEFINITION_FILE);
if (eePath != null) {
fEEFile.setText(eePath);
@@ -320,7 +327,7 @@
if (vmArgs != null) {
fVMArgs.setText(vmArgs);
}
- validateVMName();
+ validateVMName(true);
} finally {
fIgnoreCallbacks = false;
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/StandardVMPage.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/StandardVMPage.java
index 8af7ce7..058a897 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/StandardVMPage.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/StandardVMPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2018 IBM Corporation and others.
+ * Copyright (c) 2007, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -130,13 +130,13 @@
fVMName.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
- validateVMName();
+ validateVMName(false);
}
});
fJRERoot.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
- validateJRELocation();
+ validateJRELocation(false);
}
});
folders.addSelectionListener(new SelectionListener() {
@@ -178,12 +178,17 @@
/**
* Validates the JRE location
+ * @param init <code>true</code> if page is getting initialized else <code>false</code>
* @return the status after validating the JRE location
*/
- private void validateJRELocation() {
+ private void validateJRELocation(boolean init) {
String locationName = fJRERoot.getText();
IStatus s = null;
File file = null;
+ if (locationName.length() == 0 && init) {
+ return;
+ }
+
if (locationName.length() == 0) {
s = new StatusInfo(IStatus.WARNING, JREMessages.addVMDialog_enterLocation);
}
@@ -289,10 +294,11 @@
/**
* Validates the entered name of the VM
+ * @param init <code>true</code> if page is getting initialized else <code>false</code>
* @return the status of the name validation
*/
- private void validateVMName() {
- nameChanged(fVMName.getText());
+ private void validateVMName(boolean init) {
+ nameChanged(fVMName.getText(), init);
}
/* (non-Javadoc)
@@ -371,7 +377,13 @@
*/
private void initializeFields() {
fLibraryBlock.setSelection(fVM);
- fVMName.setText(fVM.getName());
+ if (fVMName.getText() != null && fVMName.getText().length() == 0) {
+ if (fVM.getName().length() != 0) {
+ fVMName.setText(fVM.getName());
+ }
+ } else {
+ fVMName.setText(fVM.getName());
+ }
File installLocation = fVM.getInstallLocation();
if (installLocation != null) {
fJRERoot.setText(installLocation.getAbsolutePath());
@@ -380,8 +392,8 @@
if (vmArgs != null) {
fVMArgs.setText(vmArgs);
}
- validateVMName();
- validateJRELocation();
+ validateVMName(true);
+ validateJRELocation(true);
}
/**