use of org.jkiss.dbeaver.model.struct.DBSObject in project dbeaver by serge-rider.
the class DataTransferWizard method loadSettings.
void loadSettings() {
// Load node settings
Collection<DBSObject> objectTypes = settings.getSourceObjects();
List<DataTransferNodeDescriptor> nodes = new ArrayList<>();
DataTransferRegistry registry = DataTransferRegistry.getInstance();
if (ArrayUtils.isEmpty(settings.getInitProducers())) {
nodes.addAll(registry.getAvailableProducers(objectTypes));
} else {
for (IDataTransferProducer source : settings.getInitProducers()) {
DataTransferNodeDescriptor node = registry.getNodeByType(source.getClass());
if (node != null && !nodes.contains(node)) {
nodes.add(node);
}
}
}
if (ArrayUtils.isEmpty(settings.getInitConsumers())) {
nodes.addAll(registry.getAvailableConsumers(objectTypes));
} else {
for (IDataTransferConsumer target : settings.getInitConsumers()) {
DataTransferNodeDescriptor node = registry.getNodeByType(target.getClass());
if (node != null && !nodes.contains(node)) {
nodes.add(node);
}
}
}
boolean settingsChanged = nodeSettings.size() != nodes.size();
if (!settingsChanged) {
List<NodePageSettings> nsList = new ArrayList<>(nodeSettings.values());
for (int i = 0; i < nodeSettings.size(); i++) {
if (nsList.get(i).sourceNode != nodes.get(i)) {
settingsChanged = true;
break;
}
}
}
if (settingsChanged) {
nodeSettings.clear();
for (DataTransferNodeDescriptor node : nodes) {
addNodeSettings(node);
}
}
updateWizardTitle();
}
use of org.jkiss.dbeaver.model.struct.DBSObject in project dbeaver by serge-rider.
the class DataTransferPagePipes method loadProducers.
private void loadProducers() {
DataTransferSettings settings = getWizard().getSettings();
Collection<DBSObject> objects = settings.getSourceObjects();
List<TransferTarget> transferTargets = new ArrayList<>();
for (DataTransferNodeDescriptor producer : DataTransferRegistry.getInstance().getAvailableProducers(objects)) {
Collection<DataTransferProcessorDescriptor> processors = producer.getAvailableProcessors(objects);
if (CommonUtils.isEmpty(processors)) {
transferTargets.add(new TransferTarget(producer, null));
} else {
for (DataTransferProcessorDescriptor processor : processors) {
transferTargets.add(new TransferTarget(producer, processor));
}
}
}
nodesTable.setInput(transferTargets);
}
use of org.jkiss.dbeaver.model.struct.DBSObject in project dbeaver by serge-rider.
the class DataTransferPagePipes method createInputsTable.
private void createInputsTable(Composite composite) {
Composite panel = UIUtils.createComposite(composite, 1);
// UIUtils.createControlLabel(panel, DTUIMessages.data_transfer_wizard_final_group_objects);
inputsTable = new TableViewer(panel, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
inputsTable.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
inputsTable.getTable().setLinesVisible(true);
inputsTable.getTable().setHeaderVisible(true);
inputsTable.setContentProvider(new ListContentProvider());
UIUtils.createTableContextMenu(inputsTable.getTable(), null);
DBNModel nModel = DBWorkbench.getPlatform().getNavigatorModel();
CellLabelProvider labelProvider = new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
DBSObject element = (DBSObject) cell.getElement();
if (cell.getColumnIndex() == 0) {
DBNDatabaseNode objectNode = nModel.getNodeByObject(element);
DBPImage icon = objectNode != null ? objectNode.getNodeIconDefault() : DBValueFormatting.getObjectImage(element);
cell.setImage(DBeaverIcons.getImage(icon));
cell.setText(DBUtils.getObjectFullName(element, DBPEvaluationContext.UI));
} else if (element.getDescription() != null) {
cell.setText(element.getDescription());
}
}
};
{
TableViewerColumn columnName = new TableViewerColumn(inputsTable, SWT.LEFT);
columnName.setLabelProvider(labelProvider);
columnName.getColumn().setText(DTMessages.data_transfer_wizard_init_column_exported);
TableViewerColumn columnDesc = new TableViewerColumn(inputsTable, SWT.LEFT);
columnDesc.setLabelProvider(labelProvider);
columnDesc.getColumn().setText(DTMessages.data_transfer_wizard_init_column_description);
}
}
use of org.jkiss.dbeaver.model.struct.DBSObject in project dbeaver by serge-rider.
the class CompileHandler method getSelectedObjects.
private List<OracleSourceObject> getSelectedObjects(ExecutionEvent event) {
List<OracleSourceObject> objects = new ArrayList<>();
final ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
if (currentSelection instanceof IStructuredSelection && !currentSelection.isEmpty()) {
for (Iterator<?> iter = ((IStructuredSelection) currentSelection).iterator(); iter.hasNext(); ) {
final Object element = iter.next();
final OracleSourceObject sourceObject = RuntimeUtils.getObjectAdapter(element, OracleSourceObject.class);
if (sourceObject != null) {
objects.add(sourceObject);
}
}
}
if (objects.isEmpty()) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if (activePart instanceof IEditorPart) {
if (((IEditorPart) activePart).getEditorInput() instanceof IDatabaseEditorInput) {
DBSObject dbsObject = ((IDatabaseEditorInput) ((IEditorPart) activePart).getEditorInput()).getDatabaseObject();
if (dbsObject instanceof OracleSourceObject) {
objects.add((OracleSourceObject) dbsObject);
}
}
}
}
return objects;
}
use of org.jkiss.dbeaver.model.struct.DBSObject in project dbeaver by serge-rider.
the class OracleScriptExecuteWizardPageSettings method saveState.
@Override
public void saveState() {
super.saveState();
OracleScriptExecuteSettings settings = wizard.getSettings();
List<DBSObject> selectedConnections = settings.getDatabaseObjects();
settings.setDataSourceContainer(selectedConnections.isEmpty() ? null : selectedConnections.get(0).getDataSource().getContainer());
settings.setInputFile(inputFileText.getText());
}
Aggregations