Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
Fixing folder opening on double click
Browse files Browse the repository at this point in the history
  • Loading branch information
mfaust committed Aug 21, 2019
1 parent 40e24ce commit 16f9908
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<items>
<MenuItem itemId="{AbstractContextMenu.OPEN_MENU_ITEM_ID}">
<baseAction>
<editor:OpenInTreeAction selectedFolderValueExpression="{config.selectedFolderValueExpression}"/>
<editor:OpenInTreeAction selectedFolderValueExpression="{config.selectedFolderValueExpression}"
selectedItemsValueExpression="{config.selectedItemsValueExpression}"/>
</baseAction>
</MenuItem>
<MenuSeparator/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.coremedia.blueprint.studio.connectors.model.ConnectorCategory;
import com.coremedia.blueprint.studio.connectors.model.ConnectorCategoryImpl;
import com.coremedia.blueprint.studio.connectors.model.ConnectorItem;
import com.coremedia.blueprint.studio.connectors.model.ConnectorObject;
import com.coremedia.blueprint.studio.connectors.model.ConnectorObjectImpl;
import com.coremedia.cms.editor.sdk.collectionview.tree.CompoundChildTreeModel;
import com.coremedia.ui.data.RemoteBean;
import com.coremedia.ui.data.ValueExpression;
Expand Down Expand Up @@ -60,7 +59,8 @@ public class ConnectorTreeModel implements CompoundChildTreeModel {

if (isConnectorId(nodeId)) {
return computeStoreText();
} else {
}
else {
var node:RemoteBean = getNodeModel(nodeId) as RemoteBean;
if (node is ConnectorCategory) {
return ConnectorCategory(node).getDisplayName();
Expand Down Expand Up @@ -192,7 +192,8 @@ public class ConnectorTreeModel implements CompoundChildTreeModel {
}

public function getIdPathFromModel(model:Object):Array {
if (!(model is ConnectorObject)) {
var hubObject:ConnectorObject = model as ConnectorObject;
if (!hubObject) {
return null;
}
if (!getConnector()) {
Expand All @@ -204,38 +205,40 @@ public class ConnectorTreeModel implements CompoundChildTreeModel {
}

var path:Array = [];
var node:RemoteBean = model as RemoteBean;
var treeNode:RemoteBean;
if (node is ConnectorItem) {
treeNode = ConnectorItem(node).getParent();
if (!treeNode) {
trace('[ERROR]', 'Parent not set for connector item ' + node.getUriPath());
}
} else {
treeNode = node;
}
var folderForGivenModel:ConnectorCategory = getParentFolderForHubObject(hubObject);

var category:ConnectorCategory = treeNode as ConnectorCategory;
if (category) {
if (folderForGivenModel) {
//we have to reverse the path to root as we want from the root.
var pathToRoot:Array = connectorCategoryTreeRelation.pathToRoot(treeNode);
var pathToRoot:Array = connectorCategoryTreeRelation.pathToRoot(folderForGivenModel);
if (pathToRoot === undefined) {
return undefined;
} else if (!pathToRoot) {
}
else if (!pathToRoot) {
return null;
}
path = pathToRoot.reverse();
//path contains the root category at top. so we need the store above it. and not catalog or something
treeNode = getConnector();
}
path.unshift(treeNode);
//add the store as top node if not happened already
if (treeNode !== getConnector()) {
path.unshift(getConnector());
//path must contain the root adapter as root folder at the top
}

path.unshift(getConnector());

return path.map(getNodeId);
}

private static function getParentFolderForHubObject(hubObject:ConnectorObject):ConnectorCategory {
var treeNode:ConnectorObject;
if (hubObject is ConnectorItem) {
treeNode = ConnectorItem(hubObject).getParent();
if (!treeNode) {
trace('[ERROR]', 'Parent not set for hub item ' + hubObject.getUriPath());
}
}
else {
treeNode = hubObject;
}
return treeNode as ConnectorCategory;
}

private function getConnector():Connector {
var connector:Connector = connectorExpression.getValue();
if (!connector.isLoaded()) {
Expand Down Expand Up @@ -290,7 +293,7 @@ public class ConnectorTreeModel implements CompoundChildTreeModel {

//must not have been loaded yet since the type is an immediate property
var thisConnector:Connector = getConnectorExpression().getValue();
if(!thisConnector) {
if (!thisConnector) {
return null;
}

Expand Down Expand Up @@ -320,7 +323,7 @@ public class ConnectorTreeModel implements CompoundChildTreeModel {

public function getTextCls(nodeId:String):String {
var connectorObject:ConnectorObject = getNodeModel(nodeId) as ConnectorObject;
if(connectorObject) {
if (connectorObject) {
return connectorObject.getTextCls();
}
return null;
Expand Down

0 comments on commit 16f9908

Please sign in to comment.