use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.
the class ConnectionAnalysisDetailsPage method getCatalogIndicators.
@Override
public List<OverviewIndUIElement> getCatalogIndicators() {
ConnectionIndicator conIndicator = (ConnectionIndicator) getCurrentModelElement().getResults().getIndicators().get(0);
Connection analyzedElement = (Connection) conIndicator.getAnalyzedElement();
EList<CatalogIndicator> catalogIndicators = conIndicator.getCatalogIndicators();
List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(analyzedElement);
for (Indicator indicator : catalogIndicators) {
if (connNode != null) {
for (IRepositoryNode catalogNode : connNode.getChildren()) {
Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
String connUuid = ResourceHelper.getUUID(catalog);
String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
if (connUuid.equals(anaUuid)) {
OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
cataUIEle.setNode(catalogNode);
cataUIEle.setOverviewIndicator(indicator);
cataUIEleList.add(cataUIEle);
break;
}
}
}
}
return cataUIEleList;
}
use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.
the class OverviewResultPage method createContextMenuFor.
protected void createContextMenuFor(final StructuredViewer viewer) {
// $NON-NLS-1$
final MenuManager contextMenu = new MenuManager("#PopUp");
// $NON-NLS-1$
contextMenu.add(new Separator("additions"));
contextMenu.setRemoveAllWhenShown(true);
contextMenu.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager mgr) {
Object overviewObject = ((StructuredSelection) viewer.getSelection()).getFirstElement();
if (overviewObject instanceof OverviewIndUIElement) {
OverviewIndUIElement overview = (OverviewIndUIElement) overviewObject;
IRepositoryNode node = overview.getNode();
List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
nodes.add(node);
contextMenu.add(new OverviewAnalysisAction(nodes));
}
// if (obj instanceof SchemaIndicator) {
// SchemaIndicator schemaIndicator = (SchemaIndicator) obj;
// contextMenu.add(new OverviewAnalysisAction(new Package[] { (Package)
// schemaIndicator.getAnalyzedElement() }));
// }
}
});
Menu menu = contextMenu.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
}
use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.
the class OverviewResultPage method displayTableAndViewComp.
/**
* DOC klliu Comment method "displayTableAndViewComp".
*
* @param schemaIndicator
* @param parentNode
*/
protected void displayTableAndViewComp(final SchemaIndicator schemaIndicator, final IRepositoryNode parentNode) {
tableAndViewComposite.setVisible(true);
// DOC wapperInput retrun OverViewUIElement
EList<TableIndicator> indicatorTableList = schemaIndicator.getTableIndicators();
List<OverviewIndUIElement> tableElements = wapperInput(indicatorTableList, parentNode);
if (tableOfCatalogOrSchemaViewer == null || tableOfCatalogOrSchemaViewer.getTable().isDisposed()) {
tableOfCatalogOrSchemaViewer = new TableViewer(tableAndViewComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | // SWT.SINGLE);
SWT.FULL_SELECTION);
final Table catalogOrSchemaTable = tableOfCatalogOrSchemaViewer.getTable();
TableUtils.addActionTooltip(catalogOrSchemaTable);
catalogOrSchemaTable.setHeaderVisible(true);
catalogOrSchemaTable.setLinesVisible(true);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
layoutData.heightHint = 150;
catalogOrSchemaTable.setLayoutData(layoutData);
String[] columnTexts = new String[] { DefaultMessagesImpl.getString("AbstractFilterMetadataPage.Table"), DefaultMessagesImpl.getString("AbstractFilterMetadataPage.rows"), DefaultMessagesImpl.getString("AbstractFilterMetadataPage.keys"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
DefaultMessagesImpl.getString("AbstractFilterMetadataPage.indexes") };
createSorterColumns(tableOfCatalogOrSchemaViewer, columnTexts, tableSorters, COLUMN_TABLE_WIDTH);
TableOfCatalogOrSchemaProvider tableProvider = new TableOfCatalogOrSchemaProvider();
tableOfCatalogOrSchemaViewer.setLabelProvider(tableProvider);
tableOfCatalogOrSchemaViewer.setContentProvider(tableProvider);
catalogOrSchemaTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
if (e.button == 3) {
TableItem item = catalogOrSchemaTable.getItem(catalogOrSchemaTable.getSelectionIndex());
// TDQ-11430: show the menu only when there have data and have selected one.
if (catalogOrSchemaTable.getItemCount() > 0 && catalogOrSchemaTable.getSelectionIndex() != -1) {
final Menu menu = new Menu(catalogOrSchemaTable.getShell(), SWT.POP_UP);
catalogOrSchemaTable.setMenu(menu);
MenuItem viewKeyMenuItem = new MenuItem(menu, SWT.PUSH);
// $NON-NLS-1$
viewKeyMenuItem.setText(DefaultMessagesImpl.getString("AbstractFilterMetadataPage.ViewKeys"));
viewKeyMenuItem.setImage(ImageLib.getImage(ImageLib.PK_DECORATE));
viewKeyMenuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
runMenu(catalogOrSchemaTable, // $NON-NLS-1$
DefaultMessagesImpl.getString("DatabaseDetailView.Tab.PrimaryKeys"));
}
});
MenuItem viewIndexMenuItem = new MenuItem(menu, SWT.PUSH);
// $NON-NLS-1$
viewIndexMenuItem.setText(DefaultMessagesImpl.getString("AbstractFilterMetadataPage.ViewIndexes"));
viewIndexMenuItem.setImage(ImageLib.getImage(ImageLib.INDEX_VIEW));
viewIndexMenuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// $NON-NLS-1$
runMenu(catalogOrSchemaTable, DefaultMessagesImpl.getString("DatabaseDetailView.Tab.Indexes"));
}
});
TableItem tableItem = catalogOrSchemaTable.getItem(catalogOrSchemaTable.getSelectionIndex());
final OverviewIndUIElement data = (OverviewIndUIElement) tableItem.getData();
MenuItem tableAnalysisMenuItem = new MenuItem(menu, SWT.PUSH);
tableAnalysisMenuItem.setText(DefaultMessagesImpl.getString(// $NON-NLS-1$
"CreateTableAnalysisAction.tableAnalysis"));
tableAnalysisMenuItem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
tableAnalysisMenuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
runTableAnalysis(data);
}
});
if (data.isVirtualNode()) {
tableAnalysisMenuItem.setEnabled(false);
}
} else {
// TDQ-11430: when there is no views will not show menu
catalogOrSchemaTable.setMenu(null);
}
}
}
});
viewOfCatalogOrSchemaViewer = new TableViewer(tableAndViewComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
final Table tableCatalogOrSchemaView = viewOfCatalogOrSchemaViewer.getTable();
TableUtils.addActionTooltip(tableCatalogOrSchemaView);
tableCatalogOrSchemaView.setHeaderVisible(true);
tableCatalogOrSchemaView.setLinesVisible(true);
layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
layoutData.heightHint = 150;
tableCatalogOrSchemaView.setLayoutData(layoutData);
columnTexts = new String[] { DefaultMessagesImpl.getString("AbstractFilterMetadataPage.view"), // $NON-NLS-1$ //$NON-NLS-2$
DefaultMessagesImpl.getString("AbstractFilterMetadataPage.rows") };
createSorterColumns(viewOfCatalogOrSchemaViewer, columnTexts, viewSorters, COLUMN_VIEW_WIDTH);
ViewOfCatalogOrSchemaProvider viewProvider = new ViewOfCatalogOrSchemaProvider();
viewOfCatalogOrSchemaViewer.setLabelProvider(viewProvider);
viewOfCatalogOrSchemaViewer.setContentProvider(viewProvider);
// ADD msjian TDQ-4523 2013-1-22: Add "Table analysis" menu on the views
tableCatalogOrSchemaView.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
if (e.button == 3) {
// TDQ-11430: show the menu only when there have data and have selected one.
TableItem tableItem = tableCatalogOrSchemaView.getItem(tableCatalogOrSchemaView.getSelectionIndex());
final OverviewIndUIElement data = (OverviewIndUIElement) tableItem.getData();
if (tableCatalogOrSchemaView.getItemCount() > 0 && tableCatalogOrSchemaView.getSelectionIndex() != -1) {
final Menu menu = new Menu(tableCatalogOrSchemaView.getShell(), SWT.POP_UP);
tableCatalogOrSchemaView.setMenu(menu);
MenuItem tableAnalysisMenuItem = new MenuItem(menu, SWT.PUSH);
tableAnalysisMenuItem.setText(DefaultMessagesImpl.getString(// $NON-NLS-1$
"CreateTableAnalysisAction.tableAnalysis"));
tableAnalysisMenuItem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
tableAnalysisMenuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ViewIndicator viewIndicator = (ViewIndicator) data.getOverviewIndicator();
runTableAnalysis(viewIndicator.getTableName());
}
});
if (data.isVirtualNode()) {
tableAnalysisMenuItem.setEnabled(false);
}
} else {
// TDQ-11430: when there is no views will not show menu
tableCatalogOrSchemaView.setMenu(null);
}
}
}
});
// TDQ-4523~
}
tableOfCatalogOrSchemaViewer.getTable().setMenu(null);
tableOfCatalogOrSchemaViewer.setInput(tableElements);
List<ViewIndicator> indicatorViewList = schemaIndicator.getViewIndicators();
List<OverviewIndUIElement> viewElements = wapperInput(indicatorViewList, parentNode);
viewOfCatalogOrSchemaViewer.setInput(viewElements);
viewOfCatalogOrSchemaViewer.getTable().setMenu(null);
// MOD xqliu 2009-11-05 bug 9521
tableAndViewComposite.pack();
statisticalSection.pack();
statisticalSection.layout();
// ~
form.reflow(true);
}
use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.
the class OverviewResultPage method wapperInput.
/**
* DOC zshen Comment method "wapperInput".
*
* @param indicatorViewList
* @param parentNode
* @return
*/
private List<OverviewIndUIElement> wapperInput(List<ViewIndicator> indicatorViewList, IRepositoryNode parentNode) {
List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
List<IRepositoryNode> children = parentNode.getChildren();
for (IRepositoryNode folderNode : children) {
if (folderNode instanceof DBViewFolderRepNode) {
List<IRepositoryNode> tableNodes = folderNode.getChildren();
// MOD 20120315 klliu&yyin TDQ-2391, avoid getting many times for table nodes.
for (ViewIndicator indicator : indicatorViewList) {
boolean equals = false;
for (IRepositoryNode tableNode : tableNodes) {
MetadataTable table = ((MetadataTableRepositoryObject) tableNode.getObject()).getTable();
String name = table.getName();
String tableName = indicator.getTableName();
// String connUuid = ResourceHelper.getUUID(table);
// String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
equals = name.equals(tableName);
if (equals) {
OverviewIndUIElement tableUIEle = new OverviewIndUIElement();
tableUIEle.setNode(tableNode);
tableUIEle.setOverviewIndicator(indicator);
if (DqRepositoryViewService.isComeFromRefrenceProject(getTdDataProvider()) && ColumnSetHelper.getColumns((ColumnSet) table).isEmpty()) {
tableUIEle.setVirtualNode(true);
}
cataUIEleList.add(tableUIEle);
break;
}
}
if (!equals) {
OverviewIndUIElement tableUIEle = new OverviewIndUIElement();
tableUIEle.setOverviewIndicator(indicator);
tableUIEle.setVirtualNode(true);
cataUIEleList.add(tableUIEle);
}
}
}
}
return cataUIEleList;
}
use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.
the class SchemaAnalysisDetailsPage method getSchemaIndicators.
@Override
protected List<OverviewIndUIElement> getSchemaIndicators() {
List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
EList<Indicator> indicators = getCurrentModelElement().getResults().getIndicators();
for (Indicator indicator : indicators) {
RepositoryNode schemaNode = RepositoryNodeHelper.recursiveFind(indicator.getAnalyzedElement());
OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
cataUIEle.setNode(schemaNode);
cataUIEle.setOverviewIndicator(indicator);
cataUIEleList.add(cataUIEle);
}
return cataUIEleList;
}
Aggregations