use of org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButtonForExtendedTable in project tdi-studio-se by Talend.
the class JSONFileMetadataEmfToolbarEditor method createRemovePushButton.
@Override
protected RemovePushButton createRemovePushButton() {
return new RemovePushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected void beforeCommandExecution() {
List beanList = this.getExtendedTableViewer().getExtendedTableModel().getBeansList();
for (int index : this.getExtendedTableViewer().getTable().getSelectionIndices()) {
MetadataColumn column = (MetadataColumn) beanList.get(index);
needUpdateInRelationMap.add(column);
}
}
@Override
protected void afterCommandExecution(Command executedCommand) {
linker.getBackgroundRefresher().refreshBackground();
}
};
}
use of org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButtonForExtendedTable in project tdi-studio-se by Talend.
the class PropertiesTableToolbarEditorView method createRemovePushButton.
@Override
protected RemovePushButton createRemovePushButton() {
RemovePushButtonForExtendedTable removePushButton = new RemovePushButtonForExtendedTable(this.toolbar, getExtendedTableViewer()) {
@Override
public boolean getEnabledState() {
if (model != null && !model.getElemParameter().getElement().isReadOnly() && (model.getElemParameter().getName().equals("HADOOP_ADVANCED_PROPERTIES") || model.getElemParameter().getName().equals("SPARK_ADVANCED_PROPERTIES") || model.getElemParameter().getName().equals("HBASE_PARAMETERS"))) {
if (getExtendedTableViewer().getTable().getSelectionIndex() > -1) {
TableItem item = extendedTableViewer.getTable().getSelection()[0];
HashMap<String, String> itemMap = (HashMap<String, String>) item.getData();
List<HashMap<String, String>> parameterValue = (List<HashMap<String, String>>) model.getElemParameter().getValue();
for (HashMap<String, String> parameterValueMap : parameterValue) {
if (parameterValueMap != null && itemMap != null && parameterValueMap.get("PROPERTY") != null && itemMap.get("PROPERTY") != null) {
if (parameterValueMap.get("PROPERTY").equals(itemMap.get("PROPERTY")) && parameterValueMap.get("VALUE").equals(itemMap.get("VALUE"))) {
if (parameterValueMap.get("BUILDIN") != null && parameterValueMap.get("BUILDIN").equals("TRUE")) {
return true;
}
}
}
}
}
}
return super.getEnabledState() && (model == null || !model.getElemParameter().isBasedOnSubjobStarts());
}
};
// TDI-6568, after remove, fire change
removePushButton.addListener(getPropertyChangeListener(), false);
return removePushButton;
}
use of org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButtonForExtendedTable in project tdi-studio-se by Talend.
the class HL7MetadataEmfToolbarEditor method createRemovePushButton.
@Override
protected RemovePushButton createRemovePushButton() {
return new RemovePushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected void beforeCommandExecution() {
List beanList = this.getExtendedTableViewer().getExtendedTableModel().getBeansList();
for (int index : this.getExtendedTableViewer().getTable().getSelectionIndices()) {
MetadataColumn column = (MetadataColumn) beanList.get(index);
needUpdateInRelationMap.add(column);
}
}
@Override
protected void afterCommandExecution(Command executedCommand) {
//$NON-NLS-N$
String key = "";
IStructuredSelection selection = (IStructuredSelection) linker.getMainui().getMetaTableViewer().getSelection();
if (selection.getFirstElement() != null && selection.getFirstElement() instanceof IModel) {
key = ((IModel) selection.getFirstElement()).getDisplayName();
}
if (!needUpdateInRelationMap.isEmpty()) {
for (MetadataColumn col : needUpdateInRelationMap) {
linker.getManager().updateRelationMapping(key, col, false);
}
}
linker.getMainui().redrawLinkers();
linker.getBackgroundRefresher().refreshBackground();
}
@Override
public boolean getEnabledState() {
// 13749
return super.getEnabledState() && !isRepository;
}
};
}
Aggregations