use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class AnalysisColumnCompareTreeViewer method createTreeViewer.
private TableViewer createTreeViewer(final List<RepositoryNode> columnList, Composite columsComp) {
TableViewer columnsElementViewer = new TableViewer(columsComp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI);
Table table = columnsElementViewer.getTable();
GridDataFactory.fillDefaults().grab(true, true).applyTo(table);
((GridData) table.getLayoutData()).heightHint = 280;
table.setHeaderVisible(true);
table.setDragDetect(true);
// $NON-NLS-1$
table.setToolTipText(DefaultMessagesImpl.getString("ColumnsComparisonMasterDetailsPage.reorderElementsByDragAnddrop"));
final TableColumn columnHeader = new TableColumn(table, SWT.CENTER);
columnHeader.setWidth(260);
columnHeader.setAlignment(SWT.CENTER);
if (columnList.size() > 0) {
RepositoryNode column = columnList.get(0);
if (column != null) {
MetadataColumnRepositoryObject colObject = (MetadataColumnRepositoryObject) column.getObject();
String tableName = ColumnHelper.getColumnOwnerAsColumnSet(colObject.getTdColumn()).getName();
// $NON-NLS-1$
columnHeader.setText(DefaultMessagesImpl.getString("ColumnsComparisonMasterDetailsPage.element", tableName));
} else {
columnList.remove(column);
// $NON-NLS-1$
columnHeader.setText("The connection is not available now!");
}
}
ColumnsElementViewerProvider provider = new ColumnsElementViewerProvider();
columnsElementViewer.setContentProvider(provider);
columnsElementViewer.setLabelProvider(provider);
columnsElementViewer.setInput(columnList);
return columnsElementViewer;
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class AnalysisColumnNominalIntervalTreeViewer method canDrop.
@Override
public boolean canDrop(IRepositoryNode modelElement) {
List<TdColumn> existColumns = new ArrayList<TdColumn>();
for (RepositoryNode columnFromMultiValueList : this.getColumnSetMultiValueList()) {
IRepositoryViewObject repObject = columnFromMultiValueList.getObject();
existColumns.add((TdColumn) ((MetadataColumnRepositoryObject) repObject).getTdColumn());
}
if (existColumns.contains(modelElement)) {
return false;
}
// MOD qiongli 2010-8-19,bug 14436:if come from diffrent table,can not drop
IRepositoryViewObject repObject = modelElement.getObject();
existColumns.add((TdColumn) ((MetadataColumnRepositoryObject) repObject).getTdColumn());
if (!existColumns.isEmpty() && !ColumnHelper.isFromSameTable(existColumns)) {
return false;
}
return true;
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class JoinConditionTableViewer method dropModelElements.
@Override
public void dropModelElements(List<? extends IRepositoryNode> modelElements, int index) {
List<TdColumn> columns = new ArrayList<TdColumn>();
for (IRepositoryNode repNode : modelElements) {
if (repNode.getObject() instanceof MetadataColumnRepositoryObject) {
TdColumn column = (TdColumn) ((MetadataColumnRepositoryObject) repNode.getObject()).getTdColumn();
if (column != null) {
columns.add(column);
}
}
}
JoinElementColumnDialog joinElementColumnDialog = new JoinElementColumnDialog(null);
if (joinElementColumnDialog.open() == Window.OK) {
JoinElement join = (JoinElement) this.myTableViewer.getElementAt(index);
if (join == null) {
join = this.addJoinElement();
}
if (join != null) {
boolean dirty = false;
for (TdColumn column : columns) {
if (column != null) {
if (!updateColumnSetPackage(column)) {
break;
}
if (COLUMN_A.equals(joinElementColumnDialog.getAb())) {
join.setColA(column);
join.setColumnAliasA(column.getName());
join.setTableAliasA(ColumnHelper.getColumnSetFullName(column));
dirty = true;
} else {
join.setColB(column);
join.setColumnAliasB(column.getName());
join.setTableAliasB(ColumnHelper.getColumnSetFullName(column));
dirty = true;
}
}
}
if (dirty) {
this.masterPage.setDirty(true);
this.myTableViewer.update(join, null);
}
}
}
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class MatchAnalysisAction method getColumns.
protected IRepositoryNode[] getColumns() {
List<IRepositoryNode> list = new ArrayList<IRepositoryNode>();
Object firstElement = getSelection().getFirstElement();
if (firstElement instanceof IRepositoryNode) {
IRepositoryNode repNode = (IRepositoryNode) firstElement;
IRepositoryViewObject repViewObject = repNode.getObject();
if (repViewObject instanceof MetadataColumnRepositoryObject || repViewObject instanceof MetadataXmlElementType) {
IRepositoryNode[] column = new IRepositoryNode[getSelection().size()];
for (int i = 0; i < getSelection().size(); i++) {
column[i] = (IRepositoryNode) getSelection().toArray()[i];
}
return column;
} else if (repViewObject instanceof MetadataTableRepositoryObject) {
Object[] selections = getSelection().toArray();
for (Object currentObj : selections) {
IRepositoryNode columnSetNode = (IRepositoryNode) currentObj;
List<IRepositoryNode> children = columnSetNode.getChildren();
if (children.size() > 0) {
list.addAll(children.get(0).getChildren());
}
}
return list.toArray(new IRepositoryNode[list.size()]);
}
}
return null;
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class AbstractPredefinedAnalysisAction method composePredefinedColumnIndicator.
protected ModelElementIndicator[] composePredefinedColumnIndicator(IndicatorEnum[] allowedEnum) {
IRepositoryNode[] columns = getColumns();
ModelElementIndicator[] predefinedColumnIndicator = new ModelElementIndicator[columns.length];
ExecutionLanguage language = ExecutionLanguage.get(getMasterPage().getExecCombo().getText());
for (int i = 0; i < columns.length; i++) {
IRepositoryNode columnNode = columns[i];
ModelElementIndicator columnIndicator = ModelElementIndicatorHelper.createModelElementIndicator(columnNode);
for (IndicatorEnum oneEnum : allowedEnum) {
columnIndicator.addTempIndicatorEnum(oneEnum);
if (oneEnum.getChildren() != null) {
for (IndicatorEnum childEnum : oneEnum.getChildren()) {
// MOD by zshen:need language to decide DatePatternFrequencyIndicator whether can be choose by
// user.
IRepositoryViewObject object = columnNode.getObject();
ModelElement element = null;
if (object instanceof MetadataColumnRepositoryObject) {
element = ((MetadataColumnRepositoryObject) object).getTdColumn();
} else if (object instanceof MetadataXmlElementTypeRepositoryObject) {
element = ((MetadataXmlElementTypeRepositoryObject) object).getModelElement();
}
if (element != null && ModelElementIndicatorRule.patternRule(childEnum, element, language)) {
columnIndicator.addTempIndicatorEnum(childEnum);
}
}
}
}
columnIndicator.storeTempIndicator();
predefinedColumnIndicator[i] = columnIndicator;
}
return predefinedColumnIndicator;
}
Aggregations