use of org.talend.dataprofiler.core.ui.views.DQRespositoryView in project tdq-studio-se by Talend.
the class CorePlugin method getCurrentSelectionNodes.
/**
* get Current all selected nodes from DQRespositoryView.
*
* @return
*/
public IRepositoryNode[] getCurrentSelectionNodes() {
DQRespositoryView repositoryView = getRepositoryView();
if (repositoryView == null) {
return null;
}
TreeItem[] selectionTreeItem = repositoryView.getCommonViewer().getTree().getSelection();
if (null == selectionTreeItem || selectionTreeItem.length == 0) {
return null;
}
IRepositoryNode[] currentSelectionNodes = new IRepositoryNode[selectionTreeItem.length];
for (int i = 0; i < selectionTreeItem.length; i++) {
currentSelectionNodes[i] = (IRepositoryNode) selectionTreeItem[i].getData();
}
return currentSelectionNodes;
}
use of org.talend.dataprofiler.core.ui.views.DQRespositoryView in project tdq-studio-se by Talend.
the class CorePlugin method getCurrentSelectionNode.
/**
* get Current the first selected node from DQRespositoryView.
*
* @return
*/
public IRepositoryNode getCurrentSelectionNode() {
DQRespositoryView repositoryView = getRepositoryView();
if (repositoryView == null) {
return null;
}
TreeItem[] selectionTreeItem = repositoryView.getCommonViewer().getTree().getSelection();
if (null != selectionTreeItem && selectionTreeItem.length > 0 && null != selectionTreeItem[0]) {
IRepositoryNode repoNode = (IRepositoryNode) selectionTreeItem[0].getData();
return repoNode;
} else {
return null;
}
}
use of org.talend.dataprofiler.core.ui.views.DQRespositoryView in project tdq-studio-se by Talend.
the class RemoveAnalysisAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
DQRespositoryView findView = CorePlugin.getDefault().getRepositoryView();
if (findView == null) {
return;
}
TreeSelection treeSelection = (TreeSelection) findView.getCommonViewer().getSelection();
TreePath[] paths = treeSelection.getPaths();
List<Analysis> analysisList;
Analysis analysisObj = null;
Map<TDQReportItem, List<Analysis>> removeMap = new HashMap<TDQReportItem, List<Analysis>>();
for (TreePath path : paths) {
Object lastSegment = path.getLastSegment();
if (!(lastSegment instanceof ReportAnalysisRepNode)) {
return;
}
// MOD sizhaoliu 2012-06-12 TDQ-5051 "Remove Anaysis" menu item is not in the right place
ReportAnalysisRepNode repNode = (ReportAnalysisRepNode) lastSegment;
analysisObj = repNode.getAnalysis();
TDQReportItem reportItem = repNode.getReportItem();
analysisList = removeMap.get(reportItem);
if (analysisList == null) {
analysisList = new ArrayList<Analysis>();
analysisList.add(analysisObj);
removeMap.put(reportItem, analysisList);
} else {
analysisList.add(analysisObj);
}
}
if (analysisObj == null) {
return;
}
String message = paths.length > 1 ? DefaultMessagesImpl.getString("RemoveAnalysisAction.areYouDeleteElement0", // $NON-NLS-1$
paths.length) : // $NON-NLS-1$
DefaultMessagesImpl.getString("RemoveAnalysisAction.areYouDeleteElement2", analysisObj.getName());
boolean openConfirm = MessageDialog.openConfirm(null, DefaultMessagesImpl.getString("RemoveAnalysisAction.confirmResourceDelete"), // $NON-NLS-1$
message);
if (openConfirm) {
Iterator<TDQReportItem> iterator = removeMap.keySet().iterator();
while (iterator.hasNext()) {
TDQReportItem reportItem = iterator.next();
ReportHelper.removeAnalyses((TdReport) reportItem.getReport(), removeMap.get(reportItem));
// save now modified resources (that contain the Dependency
// objects)
ElementWriterFactory.getInstance().createReportWriter().save(reportItem, true);
}
IFolder reportsFolder = ResourceManager.getReportsFolder();
try {
reportsFolder.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
log.error(e, e);
}
findView.getCommonViewer().refresh();
}
}
use of org.talend.dataprofiler.core.ui.views.DQRespositoryView in project tdq-studio-se by Talend.
the class ModelElementTreeMenuProvider method showDetailView.
/**
* DOC Zqin Comment method "showSelectedElements".MOD 2009-01-07 mzhao.
*
* @param newTree
*/
public void showDetailView(Tree newTree) {
TreeItem[] selection = newTree.getSelection();
if (selection.length > 0) {
RespositoryDetailView detailView = CorePlugin.getDefault().getRespositoryDetailView();
if (detailView == null) {
return;
}
DQRespositoryView dqview = CorePlugin.getDefault().getRepositoryView();
RepositoryNode node = getSelectedNode(selection);
detailView.selectionChanged(dqview, new StructuredSelection(node));
}
}
use of org.talend.dataprofiler.core.ui.views.DQRespositoryView in project tdq-studio-se by Talend.
the class TOPRepositoryService method refresh.
public void refresh() {
CorePlugin.getDefault().refreshWorkSpace();
// ~ TDQ-5133 mzhao 2012-05-31 when there are many children for a db connection, it's more elegant to collapse
// the metadata folder when refreshing the tree to save time.
IRepositoryNode metadataNode = RepositoryNodeHelper.getMetadataFolderNode(EResourceConstant.DB_CONNECTIONS);
// MOD msjian TUP-274 2012-11-14: avoid NPE of metadataNode
// getRepositoryView() maybe return null when DqRepository veiw not be opened
DQRespositoryView repositoryView = CorePlugin.getDefault().getRepositoryView();
if (repositoryView != null) {
CommonViewer commonViewer = repositoryView.getCommonViewer();
if (commonViewer != null) {
if (metadataNode != null) {
commonViewer.collapseToLevel(metadataNode, AbstractTreeViewer.ALL_LEVELS);
} else {
commonViewer.collapseAll();
}
}
}
// TUP-274~
// ~ TDQ-5311
CorePlugin.getDefault().refreshDQView();
}
Aggregations