use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class ModelElementTreeMenuProvider method previewSelectedElements.
/**
* DOC Zqin Comment method "previewSelectedElements".
*
* @param newTree
*/
private void previewSelectedElements(Tree newTree) {
TreeItem[] items = newTree.getSelection();
ModelElement[] mes = new ModelElement[items.length];
for (int i = 0; i < items.length; i++) {
ModelElementIndicator meIndicator = (ModelElementIndicator) items[i].getData(AbstractColumnDropTree.MODELELEMENT_INDICATOR_KEY);
ModelElement me = ((MetadataColumnRepositoryObject) meIndicator.getModelElementRepositoryNode().getObject()).getTdColumn();
mes[i] = me;
}
new PreviewColumnAction(mes).run();
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class DataFilterDND method installDND.
public static void installDND(final Text targetControl) {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
DQRespositoryView findView = (DQRespositoryView) activePage.findView(DQRespositoryView.ID);
final CommonViewer commonViewer = findView.getCommonViewer();
final LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();
int operations = DND.DROP_COPY | DND.DROP_MOVE;
Transfer[] transfers = new Transfer[] { transfer };
DropTarget dropTarget = new DropTarget(targetControl, operations);
dropTarget.setTransfer(transfers);
dropTarget.addDropListener(new DropTargetAdapter() {
@Override
public void dragEnter(DropTargetEvent event) {
Object obj = ((IStructuredSelection) commonViewer.getSelection()).getFirstElement();
if (!(obj instanceof DBColumnRepNode)) {
event.detail = DND.DROP_NONE;
} else {
event.detail = DND.DROP_MOVE;
event.feedback = DND.FEEDBACK_INSERT_AFTER;
}
}
@Override
public void dropAccept(DropTargetEvent event) {
// do nothing until now
}
@Override
public void drop(DropTargetEvent event) {
if (event.detail != DND.DROP_NONE) {
IStructuredSelection selection = (IStructuredSelection) commonViewer.getSelection();
if (!selection.isEmpty()) {
List list = selection.toList();
IEditorPart currentActiveEditor = CorePlugin.getDefault().getCurrentActiveEditor();
if (currentActiveEditor instanceof AnalysisEditor) {
AnalysisEditor editor = (AnalysisEditor) currentActiveEditor;
AnalysisItemEditorInput input = (AnalysisItemEditorInput) editor.getEditorInput();
for (Object object : list) {
DBColumnRepNode node = (DBColumnRepNode) object;
DbmsLanguage language = DbmsLanguageFactory.createDbmsLanguage((Analysis) input.getModel());
MetadataColumnRepositoryObject columnObject = (MetadataColumnRepositoryObject) node.getObject();
String name = columnObject.getTdColumn().getName();
targetControl.insert(language.quote(name));
// Focus text.
targetControl.forceFocus();
}
}
}
}
}
});
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class DFColumnFolderRepNode method createMdcolumnsNode.
/**
* DOC qiongli Comment method "createTdcolumnsNode".
*
* @param tdcolumns
* @param repsNodes
*/
private void createMdcolumnsNode(List<MetadataColumn> mdColumns, List<IRepositoryNode> repsNodes) {
for (MetadataColumn mdColumn : mdColumns) {
MetadataColumnRepositoryObject metadataColumn = new MetadataColumnRepositoryObject(object, mdColumn);
metadataColumn.setId(mdColumn.getLabel());
metadataColumn.setLabel(mdColumn.getLabel());
DFColumnRepNode columnNode = new DFColumnRepNode(metadataColumn, this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
columnNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_COLUMN);
columnNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_COLUMN);
metadataColumn.setRepositoryNode(columnNode);
repsNodes.add(columnNode);
}
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class CreateDateAnalysisAction method isTimeType.
// Added yyin2012-05-14 TDQ-5241
private boolean isTimeType() {
for (IRepositoryNode repositoryNode : getColumns()) {
MetadataColumn column = ((MetadataColumnRepositoryObject) repositoryNode.getObject()).getTdColumn();
int javaSQLType = ((TdColumn) column).getSqlDataType().getJavaDataType();
if (Java2SqlType.isTimeSQL(javaSQLType)) {
return true;
}
}
return false;
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class CreatePatternAnalysis method init.
@Override
public void init(ICommonActionExtensionSite site) {
if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
StructuredSelection selection = (StructuredSelection) site.getStructuredViewer().getSelection();
Object fe = selection.getFirstElement();
if (fe instanceof IRepositoryNode) {
IRepositoryViewObject object = ((IRepositoryNode) fe).getObject();
if (object instanceof TdTableRepositoryObject) {
TdTableRepositoryObject tableObject = (TdTableRepositoryObject) object;
modelElement = tableObject.getTdTable();
} else if (object instanceof TdViewRepositoryObject) {
TdViewRepositoryObject viewObject = (TdViewRepositoryObject) object;
modelElement = viewObject.getTdView();
} else if (object instanceof MetadataColumnRepositoryObject) {
MetadataColumnRepositoryObject columnObject = (MetadataColumnRepositoryObject) object;
modelElement = columnObject.getTdColumn();
}
}
}
super.init(site);
}
Aggregations