use of org.talend.dq.nodes.ReportSubFolderRepNode in project tdq-studio-se by Talend.
the class DuplicateResourceProvider method shouldShowMenu.
/**
* DOC xqliu Comment method "shouldShowMenu".
*
* @param array
* @return
*/
private boolean shouldShowMenu(Object[] array) {
List<ENodeType> nodeTypes = new ArrayList<ENodeType>();
nodeTypes.add(ENodeType.REPOSITORY_ELEMENT);
nodeTypes.add(ENodeType.TDQ_REPOSITORY_ELEMENT);
List<IRepositoryNode> repositoryNodeList = RepositoryNodeHelper.getRepositoryNodeList(array, nodeTypes);
if (repositoryNodeList.size() == 0) {
return false;
}
List<ERepositoryObjectType> objectTypes = new ArrayList<ERepositoryObjectType>();
objectTypes.add(ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_REPORT_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_INDICATOR_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_RULES_SQL);
objectTypes.add(ERepositoryObjectType.TDQ_RULES);
objectTypes.add(ERepositoryObjectType.TDQ_RULES_PARSER);
objectTypes.add(ERepositoryObjectType.TDQ_PATTERN_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_JRAXML_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_SOURCE_FILE_ELEMENT);
objectTypes.add(ERepositoryObjectType.METADATA_CONNECTIONS);
objectTypes.add(ERepositoryObjectType.TDQ_RULES_MATCHER);
objectTypes.add(ERepositoryObjectType.CONTEXT);
for (IRepositoryNode node : repositoryNodeList) {
// MOD qiongli 2011-2-12.filter elements in recycle bin.
if (RepositoryNodeHelper.isStateDeleted(node)) {
return false;
}
ERepositoryObjectType contentType = node.getObjectType();
if (contentType == null || (!objectTypes.contains(contentType) && !ConnectionUtils.isTcompJdbc(contentType.getLabel()))) {
return false;
}
RepositoryNode parent = node.getParent();
if ((parent instanceof ReportSubFolderRepNode) && (node instanceof AnalysisRepNode)) {
return false;
}
if (node instanceof ReportFileRepNode || node instanceof ReportAnalysisRepNode) {
return false;
}
}
return true;
}
use of org.talend.dq.nodes.ReportSubFolderRepNode in project tdq-studio-se by Talend.
the class RunAnalysisActionProvider method fillContextMenu.
/**
* Adds a submenu to the given menu with the name "New Component".
*/
public void fillContextMenu(IMenuManager menu) {
// MOD mzhao user readonly role on svn repository mode.
if (!isShowMenu()) {
return;
}
Object[] array = ((TreeSelection) this.getContext().getSelection()).toArray();
ArrayList<TDQAnalysisItem> selectedItemsList = new ArrayList<TDQAnalysisItem>();
for (Object obj : array) {
RepositoryNode node = (RepositoryNode) obj;
RepositoryNode parent = node.getParent();
if (!(parent instanceof ReportSubFolderRepNode)) {
// IPath append = WorkbenchUtils.getFilePath(node);
Item item = node.getObject().getProperty().getItem();
if (item instanceof TDQAnalysisItem) {
selectedItemsList.add((TDQAnalysisItem) item);
}
}
}
if (!selectedItemsList.isEmpty()) {
// IFile file = ResourceManager.getRootProject().getFile(append);
RunAnalysisAction runAnalysisAction = new RunAnalysisAction();
// runAnalysisAction.setSelectionFile(file);
runAnalysisAction.setAnalysisItems(selectedItemsList.toArray(new TDQAnalysisItem[selectedItemsList.size()]));
menu.add(runAnalysisAction);
}
}
use of org.talend.dq.nodes.ReportSubFolderRepNode in project tdq-studio-se by Talend.
the class UnitTestBuildHelper method createRealReportSubFolderRepNode.
/**
* create a real ReportSubFolderRepNode.
*
* @param parentNode the parent node
* @param folderName the folder name
* @return
*/
public static ReportSubFolderRepNode createRealReportSubFolderRepNode(RepositoryNode parentNode, String folderName) {
ReportSubFolderRepNode folderNode = null;
// create the sub folder
IFolder iFolder = RepositoryNodeHelper.getIFolder(parentNode);
createRealFolder(iFolder, folderName);
// get the ReportSubFolderRepNode
List<IRepositoryNode> subFolders = new ArrayList<IRepositoryNode>();
if (parentNode instanceof ReportFolderRepNode) {
subFolders = ((ReportFolderRepNode) parentNode).getChildren(false);
} else if (parentNode instanceof ReportSubFolderRepNode) {
subFolders = ((ReportSubFolderRepNode) parentNode).getChildren(false);
}
if (!subFolders.isEmpty()) {
for (IRepositoryNode node : subFolders) {
if (node instanceof ReportSubFolderRepNode) {
ReportSubFolderRepNode subNode = (ReportSubFolderRepNode) node;
if (folderName.equals(subNode.getLabel())) {
folderNode = subNode;
break;
}
}
}
}
return folderNode;
}
use of org.talend.dq.nodes.ReportSubFolderRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method getPath.
public static IPath getPath(IRepositoryNode node) {
if (node == null) {
return null;
}
if (node.isBin()) {
return new Path(PluginConstant.EMPTY_STRING);
}
if (node.getType() == null) {
return null;
}
switch(node.getType()) {
case SYSTEM_FOLDER:
ERepositoryObjectType contentType = node.getContentType();
if (contentType == null) {
Item item = node.getObject().getProperty().getItem();
contentType = ERepositoryObjectType.getItemType(item);
}
return new Path(ERepositoryObjectType.getFolderName(contentType));
case SIMPLE_FOLDER:
String label = PluginConstant.EMPTY_STRING;
if (node.getObject() != null) {
label = node.getObject().getProperty().getLabel();
}
if (node instanceof ReportSubFolderRepNode) {
ReportSubFolderRepNode reportSubFolderRepNode = (ReportSubFolderRepNode) node;
label = reportSubFolderRepNode.getLabel();
}
return getPath(node.getParent()).append(label);
default:
}
return getPath(node.getParent());
}
use of org.talend.dq.nodes.ReportSubFolderRepNode in project tdq-studio-se by Talend.
the class DeleteResourceProvider method shouldShowRenameFolderMenu.
private boolean shouldShowRenameFolderMenu(RepositoryNode node) {
boolean show = false;
if (node instanceof AnalysisSubFolderRepNode) {
AnalysisSubFolderRepNode anaSubFolderNode = (AnalysisSubFolderRepNode) node;
show = !anaSubFolderNode.isVirtualFolder();
} else if (node instanceof ReportSubFolderRepNode) {
ReportSubFolderRepNode repSubFolderNode = (ReportSubFolderRepNode) node;
show = !repSubFolderNode.isVirtualFolder();
} else if (node instanceof UserDefIndicatorSubFolderRepNode || node instanceof PatternRegexSubFolderRepNode || node instanceof PatternSqlSubFolderRepNode || node instanceof RulesSQLSubFolderRepNode || node instanceof RulesParserSubFolderRepNode || node instanceof DBConnectionSubFolderRepNode || node instanceof DFConnectionSubFolderRepNode || node instanceof JrxmlTempSubFolderNode) {
show = true;
}
return show;
}
Aggregations