use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class ResourceViewContentProvider method createWorkspaceRootChildren.
/**
* DOC talend Comment method "getWorkspaceRootChildren".
*
* @param element
* @return
* @throws CoreException
*/
private Object[] createWorkspaceRootChildren(Object element, String projectTechnicalLabel) throws CoreException {
Project inWhichProject = ProxyRepositoryManager.getInstance().getProjectFromProjectTechnicalLabel(projectTechnicalLabel);
Object currentOpenProject = null;
for (Object child : super.getChildren(element)) {
if (child instanceof IProject) {
if (((IProject) child).getName().equals(projectTechnicalLabel)) {
currentOpenProject = child;
break;
}
}
}
List<Object> folders = new ArrayList<Object>();
Object[] rootFolders = new Object[0];
if (currentOpenProject != null) {
rootFolders = ((IProject) currentOpenProject).members(false);
for (Object folder : rootFolders) {
IRepositoryNode node = null;
// TDQ_XXX node on the DQRepository view
if (folder instanceof IFolder && ((IFolder) folder).getName().startsWith(RepositoryNodeHelper.PREFIX_TDQ)) {
IFolder iFolder = (IFolder) folder;
if (((IFolder) folder).getName().trim().equals("TDQ_reporting_db")) {
// $NON-NLS-1$
continue;
}
IPath relativePath = iFolder.getFullPath().makeRelativeTo(((IProject) currentOpenProject).getFullPath());
ERepositoryObjectType respositoryObjectType = RepositoryNodeBuilder.getInstance().retrieveRepObjectTypeByPath(relativePath.toOSString());
node = createNewRepNode(respositoryObjectType, inWhichProject);
}
// MOD mzhao for metadata folder
if (folder instanceof IFolder) {
String folderName = ((IFolder) folder).getName();
if (EResourceConstant.METADATA.getName().equals(folderName)) {
node = createNewRepNode(ERepositoryObjectType.METADATA, inWhichProject);
} else if (PluginChecker.isTDQLoaded() && EResourceConstant.CONTEXT.getName().equals(folderName)) {
node = createNewRepNode(ERepositoryObjectType.CONTEXT, inWhichProject);
}
}
if (node != null) {
folders.add(node);
}
}
}
// add msjian TDQ-10386: Recycle Bin should remove form Referenced project
if (inWhichProject.isMainProject()) {
// add RecycleBinRepNode
RecycleBinRepNode recycleBin = new RecycleBinRepNode(DefaultMessagesImpl.getString("RecycleBin.resBinName"), // $NON-NLS-1$
inWhichProject);
folders.add(recycleBin);
}
// Reference Projects
if (org.talend.core.PluginChecker.isRefProjectLoaded() && inWhichProject.getEmfProject() != null && inWhichProject.getEmfProject().getReferencedProjects().size() > 0) {
if (!ProxyRepositoryManager.getInstance().isMergeRefProject()) {
DQRepositoryNode refProjectNode = createNewRepNode(ERepositoryObjectType.REFERENCED_PROJECTS, inWhichProject);
refProjectNode.setProperties(EProperties.LABEL, ERepositoryObjectType.REFERENCED_PROJECTS.getLabel());
refProjectNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.REFERENCED_PROJECTS);
folders.add(refProjectNode);
// create children for referenced project node
handleReferenced(refProjectNode);
}
}
return folders.toArray();
}
use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class UDIUtils method createUdiCheckedTreeSelectionDialog.
/**
* DOC xqliu Comment method "createUdiCheckedTreeSelectionDialog".
*
* @param meIndicator
* @return
*/
public static CheckedTreeSelectionDialog createUdiCheckedTreeSelectionDialog(ModelElementIndicator meIndicator) {
CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(null, new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
dialog.addFilter(new FolderObjFilter());
DQRepositoryNode udiDialogInputData = AnalysisUtils.getSelectDialogInputData(EResourceConstant.USER_DEFINED_INDICATORS);
dialog.setInput(udiDialogInputData);
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
for (Object patte : selection) {
if (patte instanceof SysIndicatorDefinitionRepNode) {
SysIndicatorDefinitionRepNode udiNode = (SysIndicatorDefinitionRepNode) patte;
IndicatorDefinition indicatorDefinition = udiNode.getIndicatorDefinition();
boolean validStatus = TaggedValueHelper.getValidStatus(indicatorDefinition);
if (!validStatus) {
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString(// $NON-NLS-1$
"AnalysisColumnTreeViewer.chooseValidUdis"));
}
}
}
return new // $NON-NLS-1$
Status(// $NON-NLS-1$
IStatus.OK, // $NON-NLS-1$
PlatformUI.PLUGIN_ID, // $NON-NLS-1$
IStatus.OK, // $NON-NLS-1$
"", null);
}
});
dialog.setContainerMode(true);
dialog.setInitialSelections(getUDIFilesByIndicator(udiDialogInputData, meIndicator));
// $NON-NLS-1$
dialog.setTitle(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udiSelector"));
// $NON-NLS-1$
dialog.setMessage(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udis"));
dialog.setSize(80, 30);
return dialog;
}
use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class RespositoryDetailView method selectionChanged.
/*
* (non-Javadoc)
*
* @seeorg.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui. IWorkbenchPart,
* org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
clearContainer();
boolean isNeedcreateDefault = true;
try {
if (part instanceof DQRespositoryView) {
StructuredSelection sel = (StructuredSelection) selection;
// MOD by zshen for bug 15750 TODO 39(13) make Detail View can be used.
Object fe = sel.getFirstElement();
// MOD klliu 2011-02-24 if choose diffirent node ,that will load diffirent child ,so that not use up.
if (fe instanceof AnalysisRepNode || fe instanceof ReportRepNode || fe instanceof SysIndicatorDefinitionRepNode || fe instanceof PatternRepNode || fe instanceof RuleRepNode) {
fe = ((IRepositoryNode) fe).getObject();
}
if (fe instanceof IFile) {
IFile fe2 = (IFile) fe;
isNeedcreateDefault = createFileDetail(isNeedcreateDefault, fe2);
} else if (fe instanceof IRepositoryViewObject) {
isNeedcreateDefault = createFileDetail(isNeedcreateDefault, (IRepositoryViewObject) fe);
} else if (fe instanceof DBConnectionRepNode) {
DBConnectionRepNode connNode = (DBConnectionRepNode) fe;
// MOD sizhaoliu TDQ-6316
ConnectionItem connectionItem = (ConnectionItem) connNode.getObject().getProperty().getItem();
createDataProviderDetail(connectionItem);
isNeedcreateDefault = false;
} else if (fe instanceof DBCatalogRepNode) {
DBCatalogRepNode catalogNode = (DBCatalogRepNode) fe;
Catalog catalog = catalogNode.getCatalog();
createTdCatalogDetail(catalog);
isNeedcreateDefault = false;
} else if (fe instanceof DBSchemaRepNode) {
DBSchemaRepNode schemaNode = (DBSchemaRepNode) fe;
Schema schema = schemaNode.getSchema();
createTdSchemaDetail(schema);
isNeedcreateDefault = false;
} else if (fe instanceof DBTableRepNode) {
DBTableRepNode tableNode = (DBTableRepNode) fe;
// MOD gdbu 2011-9-14 TDQ-3243
if (!DQRepositoryNode.isOnFilterring()) {
tableNode.getChildren().get(0).getChildren();
}
// ~TDQ-3243
TdTable tdTable = tableNode.getTdTable();
createTableDetail(tdTable);
isNeedcreateDefault = false;
} else if (fe instanceof DBViewRepNode) {
DBViewRepNode viewNode = (DBViewRepNode) fe;
// MOD gdbu 2011-9-14 TDQ-3243
if (!DQRepositoryNode.isOnFilterring()) {
viewNode.getChildren().get(0).getChildren();
}
// ~TDQ-3243
createNameCommentDetail(viewNode.getTdView());
isNeedcreateDefault = false;
} else if (fe instanceof DBColumnRepNode) {
DBColumnRepNode columnNode = (DBColumnRepNode) fe;
TdColumn column = columnNode.getTdColumn();
createTdColumn(column);
isNeedcreateDefault = false;
} else if (fe instanceof IEcosComponent) {
IEcosComponent component = (IEcosComponent) fe;
createEcosComponent(component);
isNeedcreateDefault = false;
} else if (fe instanceof RegularExpression) {
// MOD mzhao 2009-04-20,Bug 6349.
RegularExpression regularExpression = (RegularExpression) fe;
createRegularExpression(regularExpression);
isNeedcreateDefault = false;
} else if (fe instanceof PatternLanguageRepNode) {
// MOD mzhao 2012-08-15,feature TDQ-4037.
PatternLanguageRepNode pattLangNode = (PatternLanguageRepNode) fe;
createRegularExpression(pattLangNode.getRegularExpression());
isNeedcreateDefault = false;
} else if (fe instanceof SourceFileRepNode) {
// MOD klliu 2001-02-28 bug 19154
IPath filePath = WorkbenchUtils.getFilePath((SourceFileRepNode) fe);
DQRepositoryNode node = (DQRepositoryNode) fe;
IFile file = ResourceManager.getRoot().getProject(node.getProject().getTechnicalLabel()).getFile(filePath);
createSqlFileDetail(file);
} else if (fe instanceof ExchangeComponentRepNode) {
// MOD klliu 2001-02-28 bug 19154
IEcosComponent ecosComponent = ((ExchangeComponentRepNode) fe).getEcosComponent();
IEcosComponent component = ecosComponent;
createEcosComponent(component);
isNeedcreateDefault = false;
// ADD by msjian 2011-5-12 21186: don't check whether the selected object is "MDMConnectionRepNode"
} else if (fe instanceof DFConnectionRepNode) {
DFConnectionRepNode dfNode = (DFConnectionRepNode) fe;
DelimitedFileConnection dfConnection = dfNode.getDfConnection();
createDFconnectionName(dfNode.getObject().getLabel());
createDataProviderDetail(dfConnection);
isNeedcreateDefault = false;
}
if (PluginChecker.isTDQLoaded()) {
if (fe instanceof EObject) {
createTechnicalDetail((EObject) fe);
} else if (fe instanceof IFile) {
createTechnicalDetail((IFile) fe);
} else if (fe instanceof IRepositoryViewObject) {
createTechnicalDetail((IRepositoryViewObject) fe);
} else {
createExtDefault();
}
}
if (!scomp.isDisposed()) {
scomp.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
composite.layout();
}
} else if (part instanceof CommonFormEditor) {
CommonFormEditor editor = (CommonFormEditor) part;
IEditorInput editorInput = editor.getEditorInput();
if (editorInput instanceof IFileEditorInput) {
IFileEditorInput input = (IFileEditorInput) editorInput;
IFile file = input.getFile();
isNeedcreateDefault = createFileDetail(isNeedcreateDefault, file);
}
}
if (isNeedcreateDefault) {
createDefault();
}
// feature 19053
if (!gContainer.isDisposed()) {
gContainer.layout();
if (tContainer != null) {
tContainer.layout();
}
}
} catch (MissingDriverException e) {
if (PluginChecker.isOnlyTopLoaded()) {
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), // $NON-NLS-1$
DefaultMessagesImpl.getString("RespositoryDetailView.warning"), e.getErrorMessage());
} else {
log.error(e, e);
}
}
}
use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class AnalysisUtils method getAnalysisSelectDialogInputDataWithoutRef.
/**
* get Analysis Select Dialog Input Data.
*
* @param eResourceConstant
* @return
*/
public static DQRepositoryNode getAnalysisSelectDialogInputDataWithoutRef(EResourceConstant eResourceConstant) {
DQRepositoryNode node = new DQRepositoryNode(null, null, ENodeType.SYSTEM_FOLDER, ProjectManager.getInstance().getCurrentProject());
node.getChildren().clear();
IRepositoryNode analysisFolderNode = RepositoryNodeHelper.getDataProfilingFolderNode(eResourceConstant);
node.getChildren().add(analysisFolderNode);
return node;
}
use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class RepositoryNodeBuilder method createRepositoryNode.
private RepositoryNode createRepositoryNode(IRepositoryViewObject folder, RepositoryNode parentNode, EResourceConstant resConstant, org.talend.core.model.general.Project inWhichProject) throws PersistenceException {
DQRepositoryNode subFolderNode = null;
switch(resConstant) {
case ANALYSIS:
AnalysisFolderRepNode anaFolderNode = new AnalysisFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(anaFolderNode);
parentNode.getChildren().add(anaFolderNode);
return anaFolderNode;
case REPORTS:
ReportFolderRepNode repFolderNode = new ReportFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(repFolderNode);
parentNode.getChildren().add(repFolderNode);
return repFolderNode;
case INDICATORS:
IndicatorFolderRepNode indicatorFolderRepNode = new IndicatorFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(indicatorFolderRepNode);
parentNode.getChildren().add(indicatorFolderRepNode);
return indicatorFolderRepNode;
case JRXML_TEMPLATE:
JrxmlTempFolderRepNode jrxmlFolderNode = new JrxmlTempFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(jrxmlFolderNode);
parentNode.getChildren().add(jrxmlFolderNode);
return jrxmlFolderNode;
case SOURCE_FILES:
SourceFileFolderRepNode sourceFileFolder = new SourceFileFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(sourceFileFolder);
parentNode.getChildren().add(sourceFileFolder);
return sourceFileFolder;
case PATTERNS:
PatternFolderRepNode patternFolder = new PatternFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(patternFolder);
parentNode.getChildren().add(patternFolder);
return patternFolder;
case RULES:
RulesFolderRepNode ruleFolder = new RulesFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(ruleFolder);
parentNode.getChildren().add(ruleFolder);
return ruleFolder;
case DB_CONNECTIONS:
DBConnectionFolderRepNode dbFolder = new DBConnectionFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(dbFolder);
parentNode.getChildren().add(dbFolder);
return dbFolder;
case FILEDELIMITED:
DFConnectionFolderRepNode dfmFolder = new DFConnectionFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(dfmFolder);
parentNode.getChildren().add(dfmFolder);
return dfmFolder;
case HADOOP_CLUSTER:
if (HadoopClusterUtils.getDefault().isServiceInstalled()) {
HadoopClusterFolderRepNode hcFolder = new HadoopClusterFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(hcFolder);
parentNode.getChildren().add(hcFolder);
return hcFolder;
}
case EXCHANGE:
ExchangeFolderRepNode exchangeFolder = new ExchangeFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(exchangeFolder);
parentNode.getChildren().add(exchangeFolder);
return exchangeFolder;
default:
subFolderNode = new DQRepositoryNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(subFolderNode);
parentNode.getChildren().add(subFolderNode);
if (resConstant.equals(EResourceConstant.PATTERNS)) {
// MOD gdbu 2011-8-26 bug 23303 : initialization regex and sql folder when initialization pattern folder
createRepositoryNodeSubSystemFolder(subFolderNode, EResourceConstant.PATTERN_REGEX, inWhichProject);
createRepositoryNodeSubSystemFolder(subFolderNode, EResourceConstant.PATTERN_SQL, inWhichProject);
}
break;
}
return subFolderNode;
}
Aggregations