use of org.talend.dataprofiler.core.model.nodes.foldernode.TableFolderNode in project tdq-studio-se by Talend.
the class FolderNodeHelper method createTableViewNodes.
/**
* @param catalog
* @return
*/
private static IFolderNode[] createTableViewNodes(EObject eObject) {
IFolderNode[] folderNodes;
IFolderNode tabbleFolderNode = new TableFolderNode();
tabbleFolderNode.setParent(eObject);
IFolderNode viewFolderNode = new ViewFolderNode();
viewFolderNode.setParent(eObject);
folderNodes = new IFolderNode[] { tabbleFolderNode, viewFolderNode };
catalogFolderNodeMap.put(eObject, folderNodes);
return folderNodes;
}
use of org.talend.dataprofiler.core.model.nodes.foldernode.TableFolderNode in project tdq-studio-se by Talend.
the class DQRespositoryView method createPartControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.navigator.CommonNavigator#createPartControl(org.eclipse .swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
parent.setLayout(new BorderLayout());
Composite topComp = new Composite(parent, SWT.NONE);
topComp.setFont(parent.getFont());
topComp.setLayoutData(BorderLayout.NORTH);
Composite bottomComp = new Composite(parent, SWT.NONE);
bottomComp.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
bottomComp.setFont(parent.getFont());
bottomComp.setLayoutData(BorderLayout.CENTER);
topComp.setLayout(new BorderLayout());
FillLayout bottomLayout = new FillLayout(SWT.VERTICAL);
bottomComp.setLayout(bottomLayout);
createTreeFilter(topComp);
super.createPartControl(bottomComp);
// For removing the popup menu of DQRepositoryView.
// $NON-NLS-1$
MenuManager menuMgr = new MenuManager("org.talend.dataprofiler.core.ui.views.DQRespositoryView");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager menuManager) {
ISelection selection = getCommonViewer().getSelection();
getNavigatorActionService().setContext(new ActionContext(selection));
getNavigatorActionService().fillContextMenu(menuManager);
}
});
Menu menu = menuMgr.createContextMenu(getCommonViewer().getTree());
getCommonViewer().getTree().setMenu(menu);
this.addViewerFilter(EMFObjFilter.FILTER_ID);
this.addViewerFilter(ReportingFilter.FILTER_ID);
this.addViewerFilter(FolderObjFilter.FILTER_ID);
adjustFilter();
activateContext();
getCommonViewer().setSorter(null);
getCommonViewer().getTree().addTreeListener(new TreeAdapter() {
@Override
public void treeExpanded(TreeEvent e) {
TreeItem item = (TreeItem) e.item;
if (!item.getText().endsWith(")")) {
// $NON-NLS-1$
Object obj = item.getData();
if (obj instanceof TableFolderNode || obj instanceof ViewFolderNode || obj instanceof ColumnFolderNode) {
// $NON-NLS-1$ //$NON-NLS-2$
item.setText(item.getText() + "(" + item.getItemCount() + ")");
}
}
super.treeExpanded(e);
}
});
getCommonViewer().getTree().addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
boolean superDoubleClick = true;
Tree tree = (Tree) e.getSource();
Point point = new Point(e.x, e.y);
final TreeItem item = tree.getItem(point);
if (item != null) {
Object obj = item.getData();
if (obj instanceof AbstractFolderNode) {
AbstractFolderNode node = (AbstractFolderNode) obj;
node.loadChildren();
Object[] children = node.getChildren();
if (children != null) {
if (item.getText().indexOf("(") > 0) {
// $NON-NLS-1$
item.setText(// $NON-NLS-1$ //$NON-NLS-2$
item.getText().substring(0, item.getText().indexOf("(")) + "(" + children.length + // $NON-NLS-1$
")");
} else {
// $NON-NLS-1$ //$NON-NLS-2$
item.setText(item.getText() + "(" + children.length + ")");
}
}
}
if (obj instanceof IndicatorDefinition) {
IndicatorDefinition indicatorDefinition = (IndicatorDefinition) obj;
// reload object
indicatorDefinition = DefinitionHandler.getInstance().getIndicatorDefinition(indicatorDefinition.getLabel());
IndicatorEditorInput input = new IndicatorEditorInput(indicatorDefinition);
try {
CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, IndicatorEditor.class.getName());
} catch (PartInitException e1) {
log.error(e1, e1);
}
}
if (obj instanceof DQRepositoryNode) {
if (obj instanceof ReportFileRepNode) {
new OpenItemEditorAction(new IRepositoryNode[] { (IRepositoryNode) obj }).run();
} else if (obj instanceof DFConnectionRepNode) {
new EditFileDelimitedAction((IRepositoryNode) obj).run();
} else if (obj instanceof HadoopClusterConnectionRepNode && HadoopClusterUtils.getDefault().isServiceInstalled()) {
new EditHadoopClusterAction((IRepositoryNode) obj).run();
} else if (obj instanceof HDFSOfHCConnectionNode && HadoopClusterUtils.getDefault().isServiceInstalled()) {
new EditHDFSConnectionAction((IRepositoryNode) obj).run();
} else if (obj instanceof DFTableRepNode) {
new EditDFTableAction((IRepositoryNode) obj).run();
} else if (obj instanceof ContextRepNode) {
new DQEditContextAction((ContextRepNode) obj, false).run();
} else {
DQRepositoryNode repoNode = (DQRepositoryNode) obj;
if (RepositoryNodeHelper.canOpenEditor(repoNode)) {
OpenItemEditorAction openItemEditorAction = new OpenItemEditorAction(new IRepositoryNode[] { repoNode });
openItemEditorAction.run();
}
if (repoNode instanceof AnalysisRepNode || repoNode instanceof ReportRepNode || repoNode instanceof SysIndicatorDefinitionRepNode || repoNode instanceof PatternRepNode || repoNode instanceof RuleRepNode) {
superDoubleClick = false;
}
}
}
}
if (superDoubleClick) {
super.mouseDoubleClick(e);
}
}
});
getCommonViewer().getTree().addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
Tree tree = (Tree) e.getSource();
TreeItem[] selection = tree.getSelection();
for (TreeItem item : selection) {
Object data = item.getData();
DQRepositoryNode repoNode = (DQRepositoryNode) data;
if (RepositoryNodeHelper.canOpenEditor(repoNode)) {
OpenItemEditorAction openItemEditorAction = new OpenItemEditorAction(new IRepositoryNode[] { repoNode });
openItemEditorAction.run();
}
}
}
}
public void keyReleased(KeyEvent e) {
// do nothing here until now
}
});
// ~ADD mzhao for feature 6233 Load columns when selecting a table (or
// view) in DQ Repository view
getCommonViewer().addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
TreeSelection selection = (TreeSelection) event.getSelection();
Iterator<?> iterator = selection.iterator();
while (iterator.hasNext()) {
Object selectedElement = iterator.next();
if (selectedElement instanceof DBTableRepNode || selectedElement instanceof DBViewRepNode) {
((RepositoryNode) selectedElement).getChildren().get(0).getChildren();
}
}
}
});
// MOD mzhao 2011-03-10 bug 19147: filter MDM entries.
getCommonViewer().addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof IProject) {
return false;
}
return true;
}
});
// ~
}
use of org.talend.dataprofiler.core.model.nodes.foldernode.TableFolderNode in project tdq-studio-se by Talend.
the class TwoPartCheckSelectionDialog method handleTreeExpanded.
protected void handleTreeExpanded(TreeItem item) {
if (!item.getText().endsWith(")")) {
// $NON-NLS-1$
Object obj = item.getData();
if (obj instanceof TableFolderNode || obj instanceof ViewFolderNode || obj instanceof ColumnFolderNode) {
// $NON-NLS-1$ //$NON-NLS-2$
item.setText(item.getText() + "(" + item.getItemCount() + ")");
fViewer.getTree().layout();
}
}
}
Aggregations