diff --git a/distro/changelog.xml b/distro/changelog.xml
index da33e6c..29beab3 100644
--- a/distro/changelog.xml
+++ b/distro/changelog.xml
@@ -3,6 +3,8 @@
date="2015-07-06">
[Bug #718] Fixed breadcrumb path
+ [Bug #531] Workspace: create new folder doesn't work fine
+
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java
index 5deaf24..adbb319 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java
@@ -751,8 +751,16 @@ public class AppController implements SubscriberInterface {
@Override
public void onAddItem(AddFolderEvent event) {
- AppControllerExplorer.getEventBus().fireEvent(new AddFolderEvent(event.getFileSourceModel(),event.getParentFileModel()));
-
+
+ FileModel folderToInsert = event.getFileSourceModel();
+ GWT.log("Folder parent to create new folder not found, Loading from breadcrumb");
+ if(folderToInsert==null){
+ folderToInsert = wsPortlet.getToolBarPath().getLastParent();
+ GWT.log("Folder parent in breadcrumb: "+folderToInsert.getName());
+ }
+
+ if(folderToInsert!=null)
+ AppControllerExplorer.getEventBus().fireEvent(new AddFolderEvent(folderToInsert,event.getParentFileModel()));
}
});
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java
index de95116..6789419 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java
@@ -262,9 +262,7 @@ public class GxtToolBarItemFunctionality {
@Override
public void componentSelected(ButtonEvent ce) {
- AppController.getEventBus().fireEvent(
- new AddFolderEvent(gridGroupViewContainer
- .getCurrentFolderView(), null));
+ AppController.getEventBus().fireEvent(new AddFolderEvent(gridGroupViewContainer.getCurrentFolderView(), null));
}
});