Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Swanson2004-02-23 17:36:14 -0500
committerDarin Swanson2004-02-23 17:36:14 -0500
commitbe63cea37cf30715798aa866622fb7f4ce50bbef (patch)
treebd8c2de22fbabd07569db038c4c2766579d52022
parentd695d685bd7947cb6e76c2c92d3690c09af6c89b (diff)
downloadeclipse.platform.debug-be63cea37cf30715798aa866622fb7f4ce50bbef.tar.gz
eclipse.platform.debug-be63cea37cf30715798aa866622fb7f4ce50bbef.tar.xz
eclipse.platform.debug-be63cea37cf30715798aa866622fb7f4ce50bbef.zip
Bug 51101 - [Dialogs] New Builder Dialog should not come up w/ an error message
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties1
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java45
2 files changed, 28 insertions, 18 deletions
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties
index cd8980ce6..37d890369 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties
@@ -28,6 +28,7 @@ ExternalToolsMainTab.Varia&bles..._2=Variable&s...
ExternalToolsMainTab.3=Note: Enclose an argument containing spaces using double-quotes (\").
ExternalToolsMainTab.Error_reading_configuration_7=Error reading configuration
ExternalToolsMainTab.Not_a_directory=The specified location is not a directory
+ExternalToolsMainTab.30=Please specify the location of the external tool you would like to configure.
ExternalToolsUtil.Location_not_specified_by_{0}_1=Location not specified by {0}
ExternalToolsUtil.invalidLocation_{0} = The file does not exist for the external tool named {0}.
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
index 3f044fb70..a417403de 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
@@ -47,7 +47,7 @@ import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
- protected final static String FIRST_EDIT = "editedByExternalToolsMainTab"; //$NON-NLS-1$
+ public final static String FIRST_EDIT = "editedByExternalToolsMainTab"; //$NON-NLS-1$
protected Text locationField;
protected Text workDirectoryField;
@@ -62,7 +62,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
protected SelectionAdapter selectionAdapter;
protected boolean fInitializing= false;
- protected boolean firstEdit = false;
+ private boolean userEdited= false;
/**
* A listener to update for text modification and widget selection.
@@ -71,6 +71,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
public void modifyText(ModifyEvent e) {
if (!fInitializing) {
setDirty(true);
+ userEdited= true;
updateLaunchConfigurationDialog();
}
}
@@ -262,17 +263,13 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(FIRST_EDIT, true);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
public void initializeFrom(ILaunchConfiguration configuration) {
- try {
- firstEdit = configuration.getAttribute(FIRST_EDIT, true);
- } catch (CoreException e) {
- // assume false...
- }
fInitializing= true;
updateLocation(configuration);
updateWorkingDirectory(configuration);
@@ -336,8 +333,8 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
configuration.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments);
}
- if (firstEdit) {
- configuration.setAttribute(FIRST_EDIT, false);
+ if(userEdited) {
+ configuration.setAttribute(FIRST_EDIT, (String)null);
}
}
@@ -354,18 +351,29 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
public boolean isValid(ILaunchConfiguration launchConfig) {
setErrorMessage(null);
setMessage(null);
- return validateLocation() && validateWorkDirectory();
+ boolean newConfig = false;
+ try {
+ newConfig = launchConfig.getAttribute(FIRST_EDIT, false);
+ } catch (CoreException e) {
+ //assume false is correct
+ }
+ return validateLocation(newConfig) && validateWorkDirectory();
}
/**
* Validates the content of the location field.
*/
- protected boolean validateLocation() {
+ protected boolean validateLocation(boolean newConfig) {
String value = locationField.getText().trim();
- if (value.length() < 1 && isDirty()) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_cannot_be_empty_18")); //$NON-NLS-1$
- setMessage(null);
+ if (value.length() < 1) {
+ if (newConfig) {
+ setErrorMessage(null);
+ setMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.30")); //$NON-NLS-1$
+ } else {
+ setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_cannot_be_empty_18")); //$NON-NLS-1$
+ setMessage(null);
+ }
return false;
}
@@ -380,16 +388,17 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
File file = new File(location);
if (!file.exists()) { // The file does not exist.
- if (!firstEdit) {
+ if (!newConfig) {
setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_does_not_exist_19")); //$NON-NLS-1$
- return false;
}
+ return false;
}
if (!file.isFile()) {
- if (!firstEdit) {
+ if (!newConfig) {
setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_specified_is_not_a_file_20")); //$NON-NLS-1$
- return false;
+
}
+ return false;
}
return true;
}

Back to the top