diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Messages.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Messages.java index bd12ac948f3..4ae9671d42a 100644 --- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Messages.java +++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Messages.java @@ -40,6 +40,7 @@ public class Messages extends NLS { public static String RemoteCMainTab_Remote_Path_Browse_Button_Title; public static String RemoteCMainTab_SkipDownload; public static String RemoteCMainTab_ErrorNoProgram; + public static String RemoteCMainTab_ErrorRemoteProgNotAbsolute; public static String RemoteCMainTab_ErrorNoConnection; public static String RemoteCMainTab_Connection; public static String RemoteCMainTab_New; diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/messages.properties b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/messages.properties index a9c61cb44d4..ef99467f809 100644 --- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/messages.properties +++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/messages.properties @@ -39,6 +39,7 @@ RemoteCMainTab_Program=Remote Absolute File Path for C/C++ Application: RemoteCMainTab_SkipDownload=Skip download to target path. Remote_GDB_Debugger_Options=Remote GDB Debugger Options RemoteCMainTab_ErrorNoProgram=Remote executable path is not specified. +RemoteCMainTab_ErrorRemoteProgNotAbsolute=Remote executable path is not absolute. RemoteCMainTab_ErrorNoConnection=Remote Connection must be selected. RemoteCMainTab_Remote_Path_Browse_Button=Browse... RemoteCMainTab_Connection=Connection: diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java index 36f63c7c9fa..0d8e92982d9 100644 --- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java +++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java @@ -69,6 +69,7 @@ public class RemoteCDSFMainTab extends CMainTab { private static final String REMOTE_PROG_LABEL_TEXT = Messages.RemoteCMainTab_Program; private static final String SKIP_DOWNLOAD_BUTTON_TEXT = Messages.RemoteCMainTab_SkipDownload; private static final String REMOTE_PROG_TEXT_ERROR = Messages.RemoteCMainTab_ErrorNoProgram; + private static final String REMOTE_PROG_NOT_ABSOLUTE = Messages.RemoteCMainTab_ErrorRemoteProgNotAbsolute; private static final String CONNECTION_TEXT_ERROR = Messages.RemoteCMainTab_ErrorNoConnection; private static final String PRE_RUN_LABEL_TEXT = Messages.RemoteCMainTab_Prerun; @@ -132,25 +133,41 @@ public class RemoteCDSFMainTab extends CMainTab { */ @Override public boolean isValid(ILaunchConfiguration config) { - boolean retVal = super.isValid(config); - if (retVal == true) { - setErrorMessage(null); - int currentSelection = connectionCombo.getSelectionIndex(); - String connection_name = currentSelection >= 0 ? connectionCombo - .getItem(currentSelection) : ""; //$NON-NLS-1$ - if (connection_name.isEmpty()) { - setErrorMessage(CONNECTION_TEXT_ERROR); - retVal = false; - } - if (retVal) { - String name = remoteProgText.getText().trim(); - if (name.length() == 0) { - setErrorMessage(REMOTE_PROG_TEXT_ERROR); - retVal = false; - } - } + if (!super.isValid(config)) { + return false; } - return retVal; + + /* Clear any pre-existing message. */ + setErrorMessage(null); + + /* Verify that a remote connection is selected. */ + int currentSelection = connectionCombo.getSelectionIndex(); + if (currentSelection < 0) { + setErrorMessage(CONNECTION_TEXT_ERROR); + return false; + } + + String connection_name = connectionCombo.getItem(currentSelection); + if (connection_name.isEmpty()) { + setErrorMessage(CONNECTION_TEXT_ERROR); + return false; + } + + /* Verify that the remote executable file name is specified. */ + String remoteProgName = remoteProgText.getText().trim(); + if (remoteProgName.isEmpty()) { + setErrorMessage(REMOTE_PROG_TEXT_ERROR); + return false; + } + + /* Verify that the remote executable file name is absolute. */ + Path remoteProgPath = Path.forPosix(remoteProgName); + if (!remoteProgPath.isAbsolute()) { + setErrorMessage(REMOTE_PROG_NOT_ABSOLUTE); + return false; + } + + return true; } protected void createRemoteConnectionGroup(Composite parent, int colSpan) {