@@ -38,26 +38,46 @@ public static Optional<Workspace> getWorkspace(IProject project) {
3838 if (bndProject != null ) {
3939 return Optional .ofNullable (bndProject .getWorkspace ());
4040 } else {
41- IFile bndFile = project .getFile (Project .BNDFILE );
42- if (bndFile .exists ()) {
43- IPath location = bndFile .getLocation ();
44- if (location != null ) {
45- File file = location .toFile ();
46- if (file != null ) {
47- try {
48- Project nativeProject = Workspace .getProject (file .getParentFile ());
49- if (nativeProject != null ) {
50- return Optional .ofNullable (nativeProject .getWorkspace ());
41+
42+ if (isCnf (project )) {
43+
44+ try {
45+ File wsDir = project .getLocation ().toFile ().getParentFile ();
46+ return Optional .ofNullable (Workspace .getWorkspace (wsDir ));
47+ } catch (Exception e ) {
48+ }
49+ }
50+ else {
51+ IFile bndFile = project .getFile (Project .BNDFILE );
52+ if (bndFile .exists ()) {
53+ IPath location = bndFile .getLocation ();
54+ if (location != null ) {
55+ File file = location .toFile ();
56+ if (file != null ) {
57+ try {
58+ Project nativeProject = Workspace .getProject (file .getParentFile ());
59+ if (nativeProject != null ) {
60+ return Optional .ofNullable (nativeProject .getWorkspace ());
61+ }
62+ } catch (Exception e ) {
5163 }
52- } catch (Exception e ) {
5364 }
5465 }
5566 }
5667 }
68+
5769 }
5870 }
5971 return Optional .empty ();
6072 }
73+
74+ private static boolean isCnf (IProject project ) {
75+ IPath projectPath = project .getLocation ();
76+ if (projectPath != null ) {
77+ return Project .BNDCNF .equals (projectPath .lastSegment ());
78+ }
79+ return false ;
80+ }
6181
6282 public static synchronized Optional <Workspace > getGlobalWorkspace () {
6383 // TODO the UI should support display multiple workspaces and give the user a
0 commit comments