use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class ValidationRulesUtil method chooseOneComponent.
private static IComponent chooseOneComponent(List<IComponent> neededComponents, EDatabaseComponentName name, boolean quickCreateInput, boolean quickCreateOutput) {
if (neededComponents.isEmpty()) {
return null;
}
if (neededComponents.size() == 1) {
return neededComponents.get(0);
}
IComponent inputComponent = getComponentByName(name.getInputComponentName(), quickCreateInput, neededComponents);
if (inputComponent != null) {
return inputComponent;
}
IComponent outputComponent = getComponentByName(name.getOutPutComponentName(), quickCreateOutput, neededComponents);
if (outputComponent != null) {
return outputComponent;
}
IComponent defaultComponent = getComponentByName(name.getDefaultComponentName(), true, neededComponents);
if (defaultComponent != null) {
return defaultComponent;
} else {
return neededComponents.get(0);
}
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class OutputDataMapTableView method initTableFilters.
/*
* (non-Javadoc)
*
* @see org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView#initTableConstraints()
*/
@Override
protected void initTableFilters(Composite parent) {
/**
* create whereFiltersTable
*/
// createFiltersTable(parent);
//$NON-NLS-1$
filterColumnLabel = Messages.getString("OutputDataMapTableView.columnTitle.AdditionalWhereClauses");
extendedTableViewerForFilters = new ExtendedTableViewerForFilters(((OutputTable) abstractDataMapTable).getWhereTableFiltersEntriesModel(), parent) {
/*
* (non-Javadoc)
*
* @see org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView.ExtendedTableViewerForFilters#
* getTableConstraintSize()
*/
@Override
protected int getTableConstraintSize() {
int retSize = 0;
if (abstractDataMapTable instanceof OutputTable) {
retSize = ((OutputTable) abstractDataMapTable).getWhereFilterEntries().size();
}
return retSize;
}
@Override
protected void setTextCellEditor(TextCellEditor textEditor) {
if (textEditor != null) {
whereConstraintExpressionTextEditor = (Text) textEditor.getControl();
}
}
};
// correct partially layout problem with GTK when cell editor value is applied
((ExtendedTableViewerForFilters) extendedTableViewerForFilters).createFiltersTable();
TableViewerCreator tableViewerCreatorForWhereClauses = extendedTableViewerForFilters.getTableViewerCreator();
tableViewerCreatorForWhereClauses.setAdjustWidthValue(WindowSystem.isGTK() ? -20 : ADJUST_WIDTH_VALUE);
List<FilterTableEntry> whereEntries = ((OutputTable) getDataMapTable()).getWhereFilterEntries();
tableViewerCreatorForWhereClauses.init(whereEntries);
/**
* create otherFiltersTable
*/
IComponent component = getMapperManager().getComponent().getComponent();
if (component != null && "tELTOracleMap".equals(component.getName())) {
//$NON-NLS-1$
//$NON-NLS-1$
filterColumnLabel = Messages.getString("OutputDataMapTableView.columnTitle.AdditionalOtherClauses.oracle");
} else {
//$NON-NLS-1$
filterColumnLabel = Messages.getString("OutputDataMapTableView.columnTitle.AdditionalOtherClauses");
}
entendedTableViewerForOtherClauses = new ExtendedTableViewerForFilters(((OutputTable) abstractDataMapTable).getOtherTableFiltersEntriesModel(), parent) {
/*
* (non-Javadoc)
*
* @see org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView.ExtendedTableViewerForFilters#
* getTableConstraintSize()
*/
@Override
public int getTableConstraintSize() {
int retSize = 0;
if (abstractDataMapTable instanceof OutputTable) {
retSize = ((OutputTable) abstractDataMapTable).getOtherFilterEntries().size();
}
return retSize;
}
@Override
protected void setTextCellEditor(TextCellEditor textEditor) {
if (textEditor != null) {
otherConstraintExpressionTextEditor = (Text) textEditor.getControl();
}
}
};
((ExtendedTableViewerForFilters) entendedTableViewerForOtherClauses).createFiltersTable();
TableViewerCreator tableViewerCreatorForOtherClauses = entendedTableViewerForOtherClauses.getTableViewerCreator();
tableViewerCreatorForOtherClauses.setAdjustWidthValue(WindowSystem.isGTK() ? -20 : ADJUST_WIDTH_VALUE);
List<FilterTableEntry> otherEntries = ((OutputTable) getDataMapTable()).getOtherFilterEntries();
tableViewerCreatorForOtherClauses.init(otherEntries);
// updateGridDataHeightForTableConstraints(entendedTableViewerForOtherClauses.getTable());
updateGridDataHeightForTableConstraints();
if (WindowSystem.isGTK()) {
tableViewerCreatorForWhereClauses.layout();
entendedTableViewerForOtherClauses.getTableViewerCreator().layout();
}
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class ProcessComponentsHandler method filterComponents.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.components.TComponentsHandler#filterComponents(java.util.List)
*/
@Override
public List<IComponent> filterComponents(List<IComponent> allComponents) {
if (allComponents != null && allComponents.size() > 0) {
Iterator<IComponent> componentsIterator = allComponents.iterator();
while (componentsIterator.hasNext()) {
IComponent component = componentsIterator.next();
String compType = component.getPaletteType();
if (compType != null && !ComponentCategory.CATEGORY_4_DI.getName().equals(compType)) {
componentsIterator.remove();
}
}
}
return allComponents;
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class TalendEditorPaletteFactory method createEntryFrom.
public static TalendCombinedTemplateCreationEntry createEntryFrom(CombinedTemplateCreationEntry entry) {
String name = entry.getLabel();
IComponent component = ((PaletteComponentFactory) entry.getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY)).getComponent();
TalendCombinedTemplateCreationEntry newEntry = new TalendCombinedTemplateCreationEntry(name, name, Node.class, component, entry.getSmallIcon(), entry.getLargeIcon());
newEntry.setDescription(entry.getDescription());
return newEntry;
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class TalendPaletteContextMenuProvider method buildContextMenu.
@SuppressWarnings("rawtypes")
@Override
public void buildContextMenu(IMenuManager menu) {
super.buildContextMenu(menu);
boolean hasSearchComponentAction = true;
List editParts = getPaletteViewer().getSelectedEditParts();
if (!editParts.isEmpty()) {
PaletteEntry element = (PaletteEntry) ((EditPart) editParts.get(0)).getModel();
if (editParts.size() > 1) {
// search component only process one .
hasSearchComponentAction = false;
} else {
// check the entry is component or folder
if (element instanceof CombinedTemplateCreationEntry) {
Object template = ((CombinedTemplateCreationEntry) element).getTemplate();
if (template == null || !Node.class.equals(template)) {
hasSearchComponentAction = false;
}
} else {
// not component entry
hasSearchComponentAction = false;
}
}
// don't work for camel.
if (hasSearchComponentAction && isComponentsTypePalette(ComponentCategory.CATEGORY_4_CAMEL)) {
hasSearchComponentAction = false;
}
// note
//$NON-NLS-1$
boolean note = element.getLabel().equals(Messages.getString("TalendEditorPaletteFactory.Note"));
if (!note) {
if (hasSearchComponentAction) {
menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, new SearchComponentAction(getPaletteViewer()));
}
boolean showFavorAction = true;
boolean showAddFavorAction = true;
PaletteContainer pContainer = element.getParent();
if (pContainer != null) {
// Favorites Folder or components in Favorites Folder
if ((pContainer instanceof PaletteRoot && TalendEditorPaletteFactory.FAVORITES.equals(element.getLabel())) || (pContainer.getParent() instanceof PaletteRoot && TalendEditorPaletteFactory.FAVORITES.equals(pContainer.getLabel()))) {
showAddFavorAction = false;
}
}
// for INPUT/OUTPUT/TRIGGER, needn't to add to Favorites
if (element instanceof CreationToolEntry) {
Object obj = ((CreationToolEntry) element).getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY);
if (obj instanceof PaletteComponentFactory) {
IComponent component = ((PaletteComponentFactory) obj).getComponent();
EComponentType componentType = component.getComponentType();
if (componentType == EComponentType.JOBLET_INPUT_OUTPUT || componentType == EComponentType.JOBLET_TRIGGER) {
showFavorAction = false;
}
}
}
if (showFavorAction) {
// if (ShowFavoriteAction.state == true) {
if (showAddFavorAction) {
menu.appendToGroup(GEFActionConstants.GROUP_COPY, new FavoriteComponentAction(getPaletteViewer()));
} else {
menu.appendToGroup(GEFActionConstants.GROUP_COPY, new RemoveFavoriteComponentAction(getPaletteViewer()));
}
}
}
}
menu.appendToGroup(GEFActionConstants.GROUP_COPY, new HiddenFloderAction(getPaletteViewer()));
menu.appendToGroup(GEFActionConstants.GROUP_COPY, new DisplayFloderAction(getPaletteViewer()));
}
Aggregations