summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRodrigo Fraxino Araujo2013-09-24 17:17:39 (EDT)
committer Alexander Kurtakov2013-11-27 07:51:08 (EST)
commit982ec65eee5a092d0dccbe9d785ada9bb7caf197 (patch)
tree37d850daf9c5b84578c969ed688a86bc72f8ea5e
parent365428e902048308e590fe8ee1615fcab32c3cbf (diff)
downloadorg.eclipse.linuxtools-982ec65eee5a092d0dccbe9d785ada9bb7caf197.zip
org.eclipse.linuxtools-982ec65eee5a092d0dccbe9d785ada9bb7caf197.tar.gz
org.eclipse.linuxtools-982ec65eee5a092d0dccbe9d785ada9bb7caf197.tar.bz2
Fixed binary and working dir of main tab for sync projectsrefs/changes/38/16738/6
Change-Id: Ia6c3fe2012e2661d4bc64889db6502049f84fbf8 Reviewed-on: https://git.eclipse.org/r/16738 Tested-by: Hudson CI Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> IP-Clean: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyCMainTab.java87
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java23
2 files changed, 72 insertions, 38 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyCMainTab.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyCMainTab.java
index 35d6841..86d0dc9 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyCMainTab.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyCMainTab.java
@@ -142,12 +142,12 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
setControl(comp);
ProfileLaunchPlugin
- .getDefault()
- .getWorkbench()
- .getHelpSystem()
- .setHelp(
- getControl(),
- ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB);
+ .getDefault()
+ .getWorkbench()
+ .getHelpSystem()
+ .setHelp(
+ getControl(),
+ ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB);
GridLayout topLayout = new GridLayout();
comp.setLayout(topLayout);
@@ -301,10 +301,10 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
protected void handleSearchButtonSelected() {
if (getCProject() == null) {
MessageDialog
- .openInformation(
- getShell(),
- LaunchMessages.CMainTab_Project_required,
- LaunchMessages.CMainTab_Enter_project_before_searching_for_program);
+ .openInformation(
+ getShell(),
+ LaunchMessages.CMainTab_Project_required,
+ LaunchMessages.CMainTab_Enter_project_before_searching_for_program);
return;
}
@@ -531,24 +531,25 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
protected void updateWorkingDirFromConfig(ILaunchConfiguration config) {
if (workingDirText != null) {
- String workingDir = EMPTY_STRING;
+ String projectDir = EMPTY_STRING;
try {
- workingDir = config.getAttribute(ATTR_REMOTE_WORKING_DIRECTORY_NAME, EMPTY_STRING);
+ projectDir = config.getAttribute(ATTR_REMOTE_WORKING_DIRECTORY_NAME, EMPTY_STRING);
} catch (CoreException ce) {
ProfileLaunchPlugin.log(ce);
}
- if (workingDir.equals(EMPTY_STRING)){
- if(this.fProjText != null){
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IProject project = root.getProject(this.fProjText.getText());
- if(project != null){
- workingDir = project.getLocationURI().toString();
- }
+ if (projectDir.equals(EMPTY_STRING)){
+ if(this.fProjText != null){
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject project = root.getProject(this.fProjText.getText());
+ try {
+ projectDir = RemoteProxyManager.getInstance().getRemoteProjectLocation(project);
+ } catch (CoreException e) {
+ setErrorMessage(fPreviouslyCheckedWorkingDirErrorMsg = ProxyLaunchMessages.error_accessing_working_directory);
}
+ }
}
-
- workingDirText.setText(workingDir);
+ workingDirText.setText(projectDir);
}
}
@@ -595,9 +596,9 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
}
fPreviouslyCheckedCopyFromExe = name;
fPreviouslyCheckedCopyFromExeIsValid = true; // we'll flip this below if
- // not true
+ // not true
fPreviouslyCheckedCopyFromExeErrorMsg = null; // we'll set this below if
- // there's an error
+ // there's an error
IPath exePath;
URI exeURI = null;
boolean passed = false;
@@ -615,7 +616,7 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
URI projectURI = project.getLocationURI();
exeURI = new URI(projectURI.getScheme(),
projectURI.getAuthority(), projectURI.getRawPath() + '/'
- + exePath.toString(), EMPTY_STRING);
+ + exePath.toString(), EMPTY_STRING);
}
if (exeURI != null) {
passed = true;
@@ -645,7 +646,7 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
if (exeFI != null) {
if (exeFI.exists()) {
if (exeFI.getAttribute(EFS.ATTRIBUTE_EXECUTABLE) &&
- !exeFI.isDirectory()) {
+ !exeFI.isDirectory()) {
passed = true;
} else {
setErrorMessage(fPreviouslyCheckedCopyFromExeErrorMsg = ProxyLaunchMessages.copy_from_exe_does_not_have_execution_rights);
@@ -690,9 +691,9 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
}
fPreviouslyCheckedProgram = name;
fPreviouslyCheckedProgramIsValid = true; // we'll flip this below if
- // not true
+ // not true
fPreviouslyCheckedProgramErrorMsg = null; // we'll set this below if
- // there's an error
+ // there's an error
IPath exePath;
URI exeURI = null;
boolean passed = false;
@@ -711,7 +712,7 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
URI projectURI = project.getLocationURI();
exeURI = new URI(projectURI.getScheme(),
projectURI.getAuthority(), projectURI.getRawPath() + '/'
- + exePath.toString(), EMPTY_STRING);
+ + exePath.toString(), EMPTY_STRING);
}
if (exeURI != null) {
passed = true;
@@ -745,7 +746,7 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
} else {
if (exeFI.exists()) {
if (exeFI.getAttribute(EFS.ATTRIBUTE_EXECUTABLE) &&
- !exeFI.isDirectory()) {
+ !exeFI.isDirectory()) {
passed = true;
} else {
setErrorMessage(fPreviouslyCheckedProgramErrorMsg = ProxyLaunchMessages.executable_does_not_have_execution_rights);
@@ -789,9 +790,9 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
}
fPreviouslyCheckedWorkingDir = name;
fPreviouslyCheckedWorkingDirIsValid = true; // we'll flip this below if
- // not true
+ // not true
fPreviouslyCheckedWorkingDirErrorMsg = null; // we'll set this below if
- // there's an error
+ // there's an error
IPath wdPath;
URI wdURI = null;
boolean passed = false;
@@ -810,7 +811,7 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
URI projectURI = project.getLocationURI();
wdURI = new URI(projectURI.getScheme(),
projectURI.getAuthority(), projectURI.getRawPath() + '/'
- + wdPath.toString(), EMPTY_STRING);
+ + wdPath.toString(), EMPTY_STRING);
}
if (wdURI != null) {
passed = true;
@@ -1092,11 +1093,25 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
binary = (IBinary) cElement;
}
+ String projectDir = EMPTY_STRING;
+ ConfigUtils configUtils = new ConfigUtils(config);
+ IProject project = null;
+ try {
+ project = ConfigUtils.getProject(configUtils.getProjectName());
+ } catch (CoreException e) {
+ setErrorMessage(fPreviouslyCheckedWorkingDirErrorMsg = ProxyLaunchMessages.error_accessing_working_directory);
+ }
+ if(project != null){
+ try {
+ projectDir = RemoteProxyManager.getInstance().getRemoteProjectLocation(project);
+ } catch (CoreException e) {
+ setErrorMessage(fPreviouslyCheckedWorkingDirErrorMsg = ProxyLaunchMessages.error_accessing_working_directory);
+ }
+ }
+
+ String path = EMPTY_STRING;
if (binary != null) {
- String path;
path = binary.getResource().getProjectRelativePath().toOSString();
- config.setAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, path);
if (!renamed) {
String name = binary.getElementName();
int index = name.lastIndexOf('.');
@@ -1108,6 +1123,8 @@ public class RemoteProxyCMainTab extends CAbstractMainTab {
renamed = true;
}
}
+ config.setAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, projectDir + IPath.SEPARATOR + path);
if (!renamed) {
String name = getLaunchConfigurationDialog().generateName(
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java
index 13f108d..09ce4f7 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyManager.java
@@ -94,7 +94,7 @@ public class RemoteProxyManager implements IRemoteProxyManager {
return manager.getFileProxy(uri);
else
throw new CoreException(new Status(IStatus.ERROR, ProfileLaunchPlugin.PLUGIN_ID,
- IStatus.OK, Messages.RemoteProxyManager_unrecognized_scheme + scheme, null));
+ IStatus.OK, Messages.RemoteProxyManager_unrecognized_scheme + scheme, null));
}
return getLocalFileProxy(uri);
}
@@ -120,7 +120,7 @@ public class RemoteProxyManager implements IRemoteProxyManager {
if (scheme != null && !scheme.equals(LOCALSCHEME)){
IRemoteProxyManager manager = getRemoteManager(scheme);
if (manager != null)
- return manager.getLauncher(uri);
+ return manager.getLauncher(uri);
}
return new LocalLauncher();
}
@@ -145,7 +145,7 @@ public class RemoteProxyManager implements IRemoteProxyManager {
if (scheme != null && !scheme.equals(LOCALSCHEME)){
IRemoteProxyManager manager = getRemoteManager(scheme);
if (manager != null)
- return manager.getOS(uri);
+ return manager.getOS(uri);
}
return Platform.getOS();
}
@@ -161,5 +161,22 @@ public class RemoteProxyManager implements IRemoteProxyManager {
return getOS(projectURI);
}
+ /**
+ * This method gets the proper remote project location
+ * of pure remote and sync projects. Synchronized projects
+ * have a cached path and a remote one, and this method
+ * returns the remote one.
+ * @return string containing the project location
+ * @since 2.2
+ */
+ public String getRemoteProjectLocation(IProject project) throws CoreException {
+ if(project != null){
+ IRemoteFileProxy remoteFileProxy = null;
+ remoteFileProxy = getFileProxy(project);
+ URI workingDirURI = remoteFileProxy.getWorkingDir();
+ return workingDirURI.toString();
+ }
+ return null;
+ }
}