提交 8725f5e8 编写于 作者: S serge-rider

Create menu fix (class cast)

上级 d7d691f4
......@@ -224,7 +224,10 @@ public class NavigatorHandlerObjectCreateNew extends NavigatorHandlerObjectCreat
if (node instanceof DBNDataSource) {
nodeIcon = UIIcon.SQL_NEW_CONNECTION;
}
if (isCreateSupported(node, nodeItemClass)) {
if (isCreateSupported(
node.getParentNode() instanceof DBNDatabaseNode ? (DBNDatabaseNode) node.getParentNode() : null,
nodeItemClass))
{
createActions.add(
makeCreateContributionItem(
site, nodeItemClass.getName(), node.getNodeType(), nodeIcon, false));
......@@ -276,9 +279,9 @@ public class NavigatorHandlerObjectCreateNew extends NavigatorHandlerObjectCreat
return false;
}
private static boolean isCreateSupported(DBNDatabaseNode node, Class<?> objectClass) {
private static boolean isCreateSupported(DBNDatabaseNode parentNode, Class<?> objectClass) {
DBEObjectMaker objectMaker = DBWorkbench.getPlatform().getEditorsRegistry().getObjectManager(objectClass, DBEObjectMaker.class);
return objectMaker != null && objectMaker.canCreateObject(node.getValueObject());
return objectMaker != null && objectMaker.canCreateObject(parentNode == null ? null : parentNode.getValueObject());
}
private static CommandContributionItem makeCreateContributionItem(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册