use of org.talend.dq.nodes.ContextFolderRepNode in project tdq-studio-se by Talend.
the class ResourceViewContentProvider method createNewRepNode.
private DQRepositoryNode createNewRepNode(ERepositoryObjectType type, org.talend.core.model.general.Project inWhichProject) {
IRepositoryViewObject viewObject = null;
FolderItem folderItem = ProxyRepositoryFactory.getInstance().getFolderItem(inWhichProject, type, Path.EMPTY);
if (folderItem == null) {
String folderName = ERepositoryObjectType.getFolderName(type);
viewObject = new Folder(folderName, folderName);
} else {
viewObject = new Folder(folderItem.getProperty(), type);
}
DQRepositoryNode node = new DQRepositoryNode(viewObject, null, ENodeType.SYSTEM_FOLDER, inWhichProject);
if (ERepositoryObjectType.CONTEXT == type) {
node = new ContextFolderRepNode(viewObject, null, ENodeType.SYSTEM_FOLDER, inWhichProject);
}
viewObject.setRepositoryNode(node);
return node;
}
use of org.talend.dq.nodes.ContextFolderRepNode in project tdq-studio-se by Talend.
the class ResourceViewContentProvider method getRepositoryNodeChildren.
/**
* DOC talend Comment method "getRepositoryNodeChildren".
*
* @param element
* @param instance
* @return
* @throws PersistenceException
* @throws CoreException
*/
private Object[] getRepositoryNodeChildren(Object element) throws PersistenceException, CoreException {
final DQRepositoryNode node = (DQRepositoryNode) element;
// MOD gdbu 2011-7-20 bug : 23220
DQRepositoryNode.setIsReturnAllNodesWhenFiltering(false);
List<IRepositoryNode> children = node.getChildren();
DQRepositoryNode.setIsReturnAllNodesWhenFiltering(true);
if ((node instanceof DBTableFolderRepNode || node instanceof DBViewFolderRepNode || node instanceof DBColumnFolderRepNode) && !DQRepositoryNode.isOnFilterring()) {
if (0 < children.size()) {
try {
StructuredSelection structSel = new StructuredSelection(node);
if (null != treeViewer) {
ISelection tempSelection = treeViewer.getSelection();
treeViewer.setSelection(structSel);
TreeItem[] selectionItems = treeViewer.getTree().getSelection();
if (0 != selectionItems.length) {
selectionItems[0].setText(node.getLabel());
treeViewer.setSelection(tempSelection);
}
} else {
ISelection dqTreeSelection = RepositoryNodeHelper.getDQCommonViewer().getSelection();
RepositoryNodeHelper.getDQCommonViewer().setSelection(structSel);
TreeItem[] selections = RepositoryNodeHelper.getDQCommonViewer().getTree().getSelection();
if (0 != selections.length) {
selections[0].setText(node.getLabel());
}
RepositoryNodeHelper.getDQCommonViewer().setSelection(dqTreeSelection);
}
} catch (Exception e) {
log.error(e.toString());
}
}
}
if (children.size() <= 0) {
// ~23220
List<EResourceConstant> resContants = new ArrayList<EResourceConstant>();
IRepositoryViewObject viewObject = node.getObject();
String label = viewObject == null ? null : viewObject.getLabel();
if (EResourceConstant.DATA_PROFILING.getName().equals(label)) {
resContants.add(EResourceConstant.ANALYSIS);
if (PluginChecker.isTDQLoaded()) {
resContants.add(EResourceConstant.REPORTS);
}
} else if (EResourceConstant.LIBRARIES.getName().equals(label)) {
// MOD TDQ-10933 msjian 20150915: Hide the Exchange node
if (!TalendPropertiesUtil.isHideExchange()) {
resContants.add(EResourceConstant.EXCHANGE);
}
// TDQ-10933~
resContants.add(EResourceConstant.INDICATORS);
if (PluginChecker.isTDQLoaded()) {
resContants.add(EResourceConstant.JRXML_TEMPLATE);
}
resContants.add(EResourceConstant.PATTERNS);
resContants.add(EResourceConstant.RULES);
resContants.add(EResourceConstant.SOURCE_FILES);
} else if (EResourceConstant.METADATA.getName().equals(label)) {
resContants.add(EResourceConstant.DB_CONNECTIONS);
resContants.add(EResourceConstant.FILEDELIMITED);
if (PluginChecker.isTDQLoaded() && HadoopClusterUtils.getDefault().isServiceInstalled()) {
resContants.add(EResourceConstant.HADOOP_CLUSTER);
}
}
if (resContants.size() > 0) {
RepositoryNodeBuilder.getInstance().createRepositoryNodeSystemFolders(node, resContants, node.getProject());
}
} else {
// to avoid can not get reference project nodes when open the select udi/pattern/rule dialog
if (EResourceConstant.REFERENCED_PROJECT.getName().equals(node.getProperties(EProperties.LABEL))) {
if (!ProxyRepositoryManager.getInstance().isMergeRefProject()) {
for (IRepositoryNode refProjectNode : node.getChildren()) {
for (IRepositoryNode refProjectItemNode : refProjectNode.getChildren()) {
getRepositoryNodeChildren(refProjectItemNode);
}
}
}
}
}
if (node instanceof ContextFolderRepNode) {
children = ((ContextFolderRepNode) node).getChildren();
}
return sortRepositoryNode(children.toArray());
}
use of org.talend.dq.nodes.ContextFolderRepNode in project tdq-studio-se by Talend.
the class CreateNewRepositoryNodeFolder method fillContextMenu.
/**
* Adds a submenu to the given menu with the name "New Component".
*/
@Override
public void fillContextMenu(IMenuManager menu) {
if (!isShowMenu()) {
return;
}
// ADD msjian TDQ-10444: fix get error when click on the exchange node
if (isExchangeNode()) {
return;
}
// TDQ-10444~
Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();
RepositoryNode node = (RepositoryNode) obj;
RepositoryNode parent = node.getParent();
if (!(parent instanceof ReportSubFolderRepNode)) {
if (parent != null || node instanceof ContextFolderRepNode) {
IFolder folder = WorkbenchUtils.getFolder(node);
if (!(node instanceof ExchangeFolderRepNode) && !ResourceManager.getRulesFolder().equals(folder) && !ResourceManager.getPatternFolder().equals(folder) && !ResourceManager.getIndicatorFolder().equals(folder) && !ResourceService.isSubFolder(ResourceManager.getSystemIndicatorFolder(), folder) && (ENodeType.SYSTEM_FOLDER.equals(node.getType()) || ENodeType.SIMPLE_FOLDER.equals(node.getType())) && !(node instanceof HDFSOfHCFolderRepNode || node instanceof HiveOfHCFolderRepNode)) {
// MOD qiongli 2011-1-20 don't add it for recycle bin elements
if (node.getObject() != null && !node.getObject().getProperty().getItem().getState().isDeleted()) {
currentSelection = WorkbenchUtils.getFolder(node);
CreateRepositoryNodeAction createSubFolderAction = new CreateRepositoryNodeAction(currentSelection);
menu.add(createSubFolderAction);
}
}
}
}
}
Aggregations