use of org.jkiss.dbeaver.ext.oracle.model.source.OracleSourceObject in project dbeaver by serge-rider.
the class JobRunHandler method updateElement.
@Override
public void updateElement(UIElement element, Map parameters) {
List<OracleSourceObject> objects = getOracleSourceObjects(element);
if (!objects.isEmpty()) {
if (objects.size() > 1) {
element.setText("Run " + objects.size() + " jobs");
} else {
final OracleSourceObject sourceObject = objects.get(0);
String objectType = OracleUtils.formatWord(sourceObject.getSourceType().name());
element.setText("Run " + objectType);
}
}
}
use of org.jkiss.dbeaver.ext.oracle.model.source.OracleSourceObject in project dbeaver by dbeaver.
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.ext.oracle.model.source.OracleSourceObject in project dbeaver by dbeaver.
the class OracleCompilerDialog method createDialogArea.
@Override
protected Composite createDialogArea(Composite parent) {
GridData gd;
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
{
Composite unitsGroup = new Composite(composite, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 250;
gd.heightHint = 200;
gd.verticalIndent = 0;
gd.horizontalIndent = 0;
unitsGroup.setLayoutData(gd);
unitsGroup.setLayout(new GridLayout(1, false));
unitTable = new TableViewer(unitsGroup, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
{
final Table table = unitTable.getTable();
table.setLayoutData(new GridData(GridData.FILL_BOTH));
table.setLinesVisible(true);
table.setHeaderVisible(true);
}
ViewerColumnController columnController = new ViewerColumnController("OracleCompilerDialog", unitTable);
columnController.addColumn(OracleUIMessages.views_oracle_compiler_dialog_column_name, null, SWT.NONE, true, true, new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
DBSObject unit = (DBSObject) cell.getElement();
final DBNDatabaseNode node = DBNUtils.getNodeByObject(unit);
if (node != null) {
cell.setText(node.getNodeName());
cell.setImage(DBeaverIcons.getImage(node.getNodeIconDefault()));
} else {
cell.setText(unit.toString());
}
}
});
columnController.addColumn(OracleUIMessages.views_oracle_compiler_dialog_column_type, null, SWT.NONE, true, true, new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
DBSObject unit = (DBSObject) cell.getElement();
final DBNDatabaseNode node = DBNUtils.getNodeByObject(unit);
if (node != null) {
cell.setText(node.getNodeType());
} else {
// $NON-NLS-1$
cell.setText("???");
}
}
});
columnController.createColumns();
unitTable.addSelectionChangedListener(event -> {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
getButton(COMPILE_ID).setEnabled(!selection.isEmpty());
});
unitTable.addDoubleClickListener(event -> {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (!selection.isEmpty()) {
OracleSourceObject unit = (OracleSourceObject) selection.getFirstElement();
NavigatorHandlerObjectOpen.openEntityEditor(unit);
}
});
unitTable.setContentProvider(new ListContentProvider());
unitTable.setInput(compileUnits);
}
{
Composite infoGroup = new Composite(composite, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 400;
gd.heightHint = 200;
gd.verticalIndent = 0;
gd.horizontalIndent = 0;
infoGroup.setLayoutData(gd);
infoGroup.setLayout(new GridLayout(1, false));
compileLog = new ObjectCompilerLogViewer(infoGroup, null, true);
}
return composite;
}
use of org.jkiss.dbeaver.ext.oracle.model.source.OracleSourceObject in project dbeaver by dbeaver.
the class JobRunHandler method updateElement.
@Override
public void updateElement(UIElement element, Map parameters) {
List<OracleSourceObject> objects = getOracleSourceObjects(element);
if (!objects.isEmpty()) {
if (objects.size() > 1) {
element.setText("Run " + objects.size() + " jobs");
} else {
final OracleSourceObject sourceObject = objects.get(0);
String objectType = OracleUtils.formatWord(sourceObject.getSourceType().name());
element.setText("Run " + objectType);
}
}
}
Aggregations