use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor in project dbeaver by dbeaver.
the class DataTransferPagePipes method activatePage.
@Override
public void activatePage() {
if (activated) {
// Second activation - we need to disable any selectors
if (getWizard().getSettings().isPipeChangeRestricted() || getWizard().isTaskEditor()) {
nodesTable.getTable().setEnabled(false);
}
return;
}
activated = true;
if (getWizard().getSettings().isConsumerOptional()) {
setTitle(DTMessages.data_transfer_wizard_init_title);
setDescription(DTMessages.data_transfer_wizard_init_description);
loadConsumers();
} else {
setTitle(DTMessages.data_transfer_wizard_producers_title);
setDescription(DTMessages.data_transfer_wizard_producers_description);
loadProducers();
}
DataTransferNodeDescriptor consumer = getWizard().getSettings().getConsumer();
DataTransferNodeDescriptor producer = getWizard().getSettings().getProducer();
DataTransferProcessorDescriptor processor = getWizard().getSettings().getProcessor();
if (consumer != null || producer != null) {
Collection<TransferTarget> targets = (Collection<TransferTarget>) nodesTable.getInput();
for (TransferTarget target : targets) {
if ((target.node == consumer || target.node == producer) && target.processor == processor) {
UIUtils.asyncExec(() -> {
nodesTable.setSelection(new StructuredSelection(target));
setSelectedSettings();
});
break;
}
}
}
inputsTable.setInput(getWizard().getSettings().getSourceObjects());
UIUtils.maxTableColumnsWidth(inputsTable.getTable());
UIUtils.maxTableColumnsWidth(nodesTable.getTable());
updatePageCompletion();
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor in project dbeaver by serge-rider.
the class PreviewMappingDialog method getNodeSettings.
@NotNull
private IDataTransferSettings getNodeSettings(IDataTransferNode node) throws DBException {
DataTransferNodeDescriptor producerNode = DataTransferRegistry.getInstance().getNodeByType(node.getClass());
if (producerNode == null) {
throw new DBException("Cannot find node descriptor for " + node.getClass().getName());
}
IDataTransferSettings producerSettings = dtSettings.getNodeSettings(producerNode);
if (producerSettings == null) {
throw new DBException("Cannot find node settings for " + producerNode.getName());
}
return producerSettings;
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor in project dbeaver by serge-rider.
the class DataTransferPagePipes method activatePage.
@Override
public void activatePage() {
if (activated) {
// Second activation - we need to disable any selectors
if (getWizard().getSettings().isPipeChangeRestricted() || getWizard().isTaskEditor()) {
nodesTable.getTable().setEnabled(false);
}
return;
}
activated = true;
if (getWizard().getSettings().isConsumerOptional()) {
setTitle(DTMessages.data_transfer_wizard_init_title);
setDescription(DTMessages.data_transfer_wizard_init_description);
loadConsumers();
} else {
setTitle(DTMessages.data_transfer_wizard_producers_title);
setDescription(DTMessages.data_transfer_wizard_producers_description);
loadProducers();
}
DataTransferNodeDescriptor consumer = getWizard().getSettings().getConsumer();
DataTransferNodeDescriptor producer = getWizard().getSettings().getProducer();
DataTransferProcessorDescriptor processor = getWizard().getSettings().getProcessor();
if (consumer != null || producer != null) {
Collection<TransferTarget> targets = (Collection<TransferTarget>) nodesTable.getInput();
for (TransferTarget target : targets) {
if ((target.node == consumer || target.node == producer) && target.processor == processor) {
UIUtils.asyncExec(() -> {
nodesTable.setSelection(new StructuredSelection(target));
setSelectedSettings();
});
break;
}
}
}
inputsTable.setInput(getWizard().getSettings().getSourceObjects());
UIUtils.maxTableColumnsWidth(inputsTable.getTable());
UIUtils.maxTableColumnsWidth(nodesTable.getTable());
updatePageCompletion();
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor in project dbeaver by serge-rider.
the class ResultSetHandlerCopyAs method fillCopyAsMenu.
public static void fillCopyAsMenu(ResultSetViewer viewer, IContributionManager copyAsMenu) {
IWorkbenchPartSite site = viewer.getSite();
copyAsMenu.add(ActionUtils.makeCommandContribution(site, ResultSetHandlerCopySpecial.CMD_COPY_SPECIAL));
copyAsMenu.add(ActionUtils.makeCommandContribution(site, ResultSetHandlerCopySpecial.CMD_COPY_COLUMN_NAMES));
copyAsMenu.add(ActionUtils.makeCommandContribution(site, ResultSetHandlerMain.CMD_COPY_ROW_NAMES));
// Add copy commands for different formats
copyAsMenu.add(new Separator());
ResultSetDataContainerOptions options = new ResultSetDataContainerOptions();
ResultSetDataContainer dataContainer = new ResultSetDataContainer(viewer, options);
List<DataTransferProcessorDescriptor> appProcessors = new ArrayList<>();
for (final DataTransferNodeDescriptor consumerNode : DataTransferRegistry.getInstance().getAvailableConsumers(Collections.singleton(dataContainer))) {
for (DataTransferProcessorDescriptor processor : consumerNode.getProcessors()) {
if (processor.isBinaryFormat()) {
continue;
}
appProcessors.add(processor);
}
}
appProcessors.sort(Comparator.comparing(DataTransferProcessorDescriptor::getName));
for (DataTransferProcessorDescriptor processor : appProcessors) {
CommandContributionItemParameter params = new CommandContributionItemParameter(site, processor.getId(), ResultSetHandlerCopyAs.CMD_COPY_AS, CommandContributionItem.STYLE_PUSH);
params.label = processor.getName();
if (processor.getIcon() != null) {
params.icon = DBeaverIcons.getImageDescriptor(processor.getIcon());
}
Map<String, Object> parameters = new HashMap<>();
parameters.put(ResultSetHandlerCopyAs.PARAM_PROCESSOR_ID, processor.getFullId());
params.parameters = parameters;
copyAsMenu.add(new CommandContributionItem(params));
}
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor in project dbeaver by serge-rider.
the class ResultSetHandlerOpenWith method getDefaultAppProcessor.
private static DataTransferProcessorDescriptor getDefaultAppProcessor() {
List<DataTransferProcessorDescriptor> processors = new ArrayList<>();
for (final DataTransferNodeDescriptor consumerNode : DataTransferRegistry.getInstance().getNodes(DataTransferNodeDescriptor.NodeType.CONSUMER)) {
for (DataTransferProcessorDescriptor processor : consumerNode.getProcessors()) {
if (processor.getAppFileExtension() != null) {
processors.add(processor);
}
}
}
processors.sort(Comparator.comparingInt(DataTransferProcessorDescriptor::getOrder));
return processors.isEmpty() ? null : processors.get(0);
}
Aggregations