use of org.talend.dataquality.domain.pattern.ExpressionType in project tdq-studio-se by Talend.
the class NewSourcePatternActionProvider method fillContextMenu.
public void fillContextMenu(IMenuManager menu) {
// MOD mzhao user readonly role on svn repository mode.
if (!isShowMenu()) {
return;
}
TreeSelection treeSelection = ((TreeSelection) this.getContext().getSelection());
List<IFile> selectedFiles = new ArrayList<IFile>();
if (treeSelection.size() == 1) {
Object obj = treeSelection.getFirstElement();
if (obj instanceof RepositoryNode) {
RepositoryNode node = (RepositoryNode) obj;
if (ENodeType.SYSTEM_FOLDER.equals(node.getType()) || ENodeType.SIMPLE_FOLDER.equals(node.getType())) {
try {
IFolder folder = WorkbenchUtils.getFolder(node);
ExpressionType type = null;
if (ResourceService.isSubFolder(ResourceManager.getPatternRegexFolder(), folder)) {
type = ExpressionType.REGEXP;
} else if (ResourceService.isSubFolder(ResourceManager.getPatternSQLFolder(), folder)) {
type = ExpressionType.SQL_LIKE;
}
if (type != null) {
menu.add(new CreatePatternAction(folder, type));
menu.add(new ImportPatternsAction(node, type));
menu.add(new ExportPatternsAction(node, false));
menu.add(new ExportPatternsAction(node, true));
}
} catch (Exception e) {
log.error(e, e);
}
}
}
// else if (obj instanceof IFile) {
// IFile file = (IFile) obj;
// if (EXTENSION_PATTERN.equalsIgnoreCase(file.getFileExtension())) {
// // menu.add(new RenameSqlFileAction((IFile) obj));
// }
// }
}
boolean isSelectFile = computeSelectedFiles(treeSelection, selectedFiles);
if (!isSelectFile && !selectedFiles.isEmpty()) {
// menu.add(new OpenSqlFileAction(selectedFiles));
// menu.add(new DeletePatternAction(selectedFiles));
}
}
Aggregations