Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,46 @@ public static Optional<Workspace> getWorkspace(IProject project) {
if (bndProject != null) {
return Optional.ofNullable(bndProject.getWorkspace());
} else {
IFile bndFile = project.getFile(Project.BNDFILE);
if (bndFile.exists()) {
IPath location = bndFile.getLocation();
if (location != null) {
File file = location.toFile();
if (file != null) {
try {
Project nativeProject = Workspace.getProject(file.getParentFile());
if (nativeProject != null) {
return Optional.ofNullable(nativeProject.getWorkspace());

if(isCnf(project)) {

try {
File wsDir = project.getLocation().toFile().getParentFile();
return Optional.ofNullable(Workspace.getWorkspace(wsDir));
} catch (Exception e) {
}
}
else {
IFile bndFile = project.getFile(Project.BNDFILE);
if (bndFile.exists()) {
IPath location = bndFile.getLocation();
if (location != null) {
File file = location.toFile();
if (file != null) {
try {
Project nativeProject = Workspace.getProject(file.getParentFile());
if (nativeProject != null) {
return Optional.ofNullable(nativeProject.getWorkspace());
}
} catch (Exception e) {
}
} catch (Exception e) {
}
}
}
}

}
}
return Optional.empty();
}

private static boolean isCnf(IProject project) {
IPath projectPath = project.getLocation();
if (projectPath != null) {
return Project.BNDCNF.equals(projectPath.lastSegment());
}
return false;
}

public static synchronized Optional<Workspace> getGlobalWorkspace() {
// TODO the UI should support display multiple workspaces and give the user a
Expand Down
Loading