You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.
First of all : great plugin!
I have had problems opening files with the remote command. I finally found the cause:
In OpenFileCommandRunner.javaFileToPluginFile the String javaFile can get truncated in one round of the for loop and might then be wrong in all following rounds. I suggest using a temporary string:
private IFile javaFileToPluginFile(String javaFile) {
for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
if (!project.isOpen()) continue; // TODO opening of project ?? String tempFileName = javaFile;
if (javaFile.startsWith('/' + project.getName())) { tempFileName = javaFile.substring(project.getName().length() + 1);
} else if (javaFile.startsWith("/")) { // absolute system path
final String projectPath = project.getLocation().toOSString();
if (javaFile.length() < projectPath.length()) continue; tempFileName = javaFile.substring(projectPath.length());
}
IFile file = project.getFile(tempFileName );
if (file.exists()) {
return file;
}
}
return null;
}
The text was updated successfully, but these errors were encountered:
Yes. I think you are right.
I personally am no longer actively using eclipse-remote-control. If you can
fix the problem I would be happy about a pull request on github.
Thanks,
Markus
2017-02-24 18:12 GMT+01:00 flmueller <[email protected]>:
First of all : great plugin!
I have multiple projects with different name lengths in one workspace and
have had problems opening files with the remote command. I finally found
the cause:
In *OpenFileCommandRunner.javaFileToPluginFile* the String *javaFile* can
be truncated in one round of the for loop so it will not be longer the
original String in the following rounds.
I suggest using a temporary string instead:
private IFile javaFileToPluginFile(String javaFile) {
for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects())
{
if (!project.isOpen()) continue; // TODO opening of project ??
*String tempFileName = javaFile;*
if (javaFile.startsWith('/' + project.getName())) {
**tempFileName ** = javaFile.substring(project.getName().length() + 1);
} else if (javaFile.startsWith("/")) { // absolute system path
final String projectPath = project.getLocation().toOSString();
if (javaFile.length() < projectPath.length()) continue;
*tempFileName* = javaFile.substring(projectPath.length());
}
IFile file = project.getFile(*tempFileName* );
if (file.exists()) {
return file;
}
}
return null;
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAGXp2BwmHVTmd5xOc_jv0JS1cVS9Ibeks5rfw-ZgaJpZM4MLc2r>
.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
First of all : great plugin!
I have had problems opening files with the remote command. I finally found the cause:
In OpenFileCommandRunner.javaFileToPluginFile the String javaFile can get truncated in one round of the for loop and might then be wrong in all following rounds. I suggest using a temporary string:
private IFile javaFileToPluginFile(String javaFile) {
for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
if (!project.isOpen()) continue; // TODO opening of project ??
String tempFileName = javaFile;
if (javaFile.startsWith('/' + project.getName())) {
tempFileName = javaFile.substring(project.getName().length() + 1);
} else if (javaFile.startsWith("/")) { // absolute system path
final String projectPath = project.getLocation().toOSString();
if (javaFile.length() < projectPath.length()) continue;
tempFileName = javaFile.substring(projectPath.length());
}
IFile file = project.getFile(tempFileName );
if (file.exists()) {
return file;
}
}
return null;
}
The text was updated successfully, but these errors were encountered: