提交 930f75ab 编写于 作者: S Serge Rider

Void progress monitor usage refactored

上级 b05589b2
......@@ -225,7 +225,7 @@ public class DBeaverUI implements DBUICallback {
return new DBRRunnableContext() {
@Override
public void run(boolean fork, boolean cancelable, DBRRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
runnable.run(VoidProgressMonitor.INSTANCE);
runnable.run(new VoidProgressMonitor());
}
};
}
......
......@@ -186,7 +186,7 @@ public class ProjectRegistry implements DBPProjectManager, DBPExternalFileManage
}
// Check resource is synced
if (resource instanceof IFile && !resource.isSynchronized(IResource.DEPTH_ZERO)) {
ContentUtils.syncFile(VoidProgressMonitor.INSTANCE, resource);
ContentUtils.syncFile(new VoidProgressMonitor(), resource);
}
// Find handler
......
......@@ -256,7 +256,7 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
}
if (getParent() != null) {
// Use void monitor because this object already read by readValue
object = getParent().getGroupObject(object, VoidProgressMonitor.INSTANCE);
object = getParent().getGroupObject(object, new VoidProgressMonitor());
}
if (value == null) {
// Check for primitive argument
......
......@@ -117,7 +117,7 @@ public class ColumnsMappingDialog extends StatusDialog {
DatabaseMappingAttribute attribute = (DatabaseMappingAttribute) item.getData();
attribute.setMappingType(DatabaseMappingType.existing);
try {
attribute.updateMappingType(VoidProgressMonitor.INSTANCE);
attribute.updateMappingType(new VoidProgressMonitor());
} catch (DBException e1) {
updateStatus(GeneralUtils.makeExceptionStatus(e1));
}
......@@ -185,7 +185,7 @@ public class ColumnsMappingDialog extends StatusDialog {
mapping.getParent().getTarget() instanceof DBSEntity)
{
DBSEntity parentEntity = (DBSEntity)mapping.getParent().getTarget();
for (DBSEntityAttribute attr : CommonUtils.safeCollection(parentEntity.getAttributes(VoidProgressMonitor.INSTANCE))) {
for (DBSEntityAttribute attr : CommonUtils.safeCollection(parentEntity.getAttributes(new VoidProgressMonitor()))) {
items.add(attr.getName());
}
}
......@@ -228,7 +228,7 @@ public class ColumnsMappingDialog extends StatusDialog {
attrMapping.getParent().getTarget() instanceof DBSEntity)
{
DBSEntity parentEntity = (DBSEntity)attrMapping.getParent().getTarget();
for (DBSEntityAttribute attr : CommonUtils.safeCollection(parentEntity.getAttributes(VoidProgressMonitor.INSTANCE))) {
for (DBSEntityAttribute attr : CommonUtils.safeCollection(parentEntity.getAttributes(new VoidProgressMonitor()))) {
if (name.equalsIgnoreCase(attr.getName())) {
attrMapping.setTarget(attr);
attrMapping.setMappingType(DatabaseMappingType.existing);
......
......@@ -254,7 +254,7 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
if (element instanceof DatabaseMappingAttribute) {
DatabaseMappingAttribute attribute = (DatabaseMappingAttribute) item.getData();
attribute.setMappingType(DatabaseMappingType.existing);
attribute.updateMappingType(VoidProgressMonitor.INSTANCE);
attribute.updateMappingType(new VoidProgressMonitor());
} else if (element instanceof DatabaseMappingContainer) {
DatabaseMappingContainer container = (DatabaseMappingContainer) element;
setMappingTarget(container, container.getSource().getName());
......@@ -506,7 +506,7 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
if (settings.getContainer() != null) {
// container's tables
DBSObjectContainer container = settings.getContainer();
for (DBSObject child : container.getChildren(VoidProgressMonitor.INSTANCE)) {
for (DBSObject child : container.getChildren(new VoidProgressMonitor())) {
if (child instanceof DBSDataManipulator) {
items.add(child.getName());
}
......@@ -524,7 +524,7 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
}
if (mapping.getParent().getTarget() instanceof DBSEntity) {
DBSEntity parentEntity = (DBSEntity)mapping.getParent().getTarget();
for (DBSEntityAttribute attr : parentEntity.getAttributes(VoidProgressMonitor.INSTANCE)) {
for (DBSEntityAttribute attr : parentEntity.getAttributes(new VoidProgressMonitor())) {
items.add(attr.getName());
}
}
......@@ -555,7 +555,7 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
if (settings.getContainer() != null) {
// container's tables
DBSObjectContainer container = settings.getContainer();
for (DBSObject child : container.getChildren(VoidProgressMonitor.INSTANCE)) {
for (DBSObject child : container.getChildren(new VoidProgressMonitor())) {
if (child instanceof DBSDataManipulator && name.equalsIgnoreCase(child.getName())) {
containerMapping.setTarget((DBSDataManipulator)child);
containerMapping.refreshMappingType(getWizard().getContainer(), DatabaseMappingType.existing);
......@@ -569,7 +569,7 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
DatabaseMappingAttribute attrMapping = (DatabaseMappingAttribute) mapping;
if (attrMapping.getParent().getTarget() instanceof DBSEntity) {
DBSEntity parentEntity = (DBSEntity)attrMapping.getParent().getTarget();
for (DBSEntityAttribute attr : parentEntity.getAttributes(VoidProgressMonitor.INSTANCE)) {
for (DBSEntityAttribute attr : parentEntity.getAttributes(new VoidProgressMonitor())) {
if (name.equalsIgnoreCase(attr.getName())) {
attrMapping.setMappingType(DatabaseMappingType.existing);
attrMapping.setTarget(attr);
......@@ -664,7 +664,7 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
}
DBPDataSource dataSource = container.getDataSource();
try {
final String ddl = DatabaseTransferConsumer.generateTargetTableDDL(VoidProgressMonitor.INSTANCE, dataSource, container, mapping);
final String ddl = DatabaseTransferConsumer.generateTargetTableDDL(new VoidProgressMonitor(), dataSource, container, mapping);
ViewSQLDialog dialog = new ViewSQLDialog(
DBeaverUI.getActiveWorkbenchWindow().getActivePage().getActivePart().getSite(),
dataSource.getDefaultContext(true),
......
......@@ -81,7 +81,7 @@ class DatabaseMappingContainer implements DatabaseMappingObject {
final Collection<DatabaseMappingAttribute> mappings = getAttributeMappings(context);
if (!CommonUtils.isEmpty(mappings)) {
for (DatabaseMappingAttribute attr : mappings) {
attr.updateMappingType(VoidProgressMonitor.INSTANCE);
attr.updateMappingType(new VoidProgressMonitor());
}
}
}
......@@ -147,7 +147,7 @@ class DatabaseMappingContainer implements DatabaseMappingObject {
if (attributeMappings.isEmpty()) {
try {
// Do not use runnable context! It changes active focus and locks UI which breakes whole jface editing framework
readAttributes(VoidProgressMonitor.INSTANCE);
readAttributes(new VoidProgressMonitor());
} catch (DBException e) {
UIUtils.showErrorDialog(null, "Attributes read failed", "Can't get attributes from " + DBUtils.getObjectFullName(source, DBPEvaluationContext.UI), e);
}
......
......@@ -104,7 +104,7 @@ public class LoadingJob<RESULT> extends AbstractJob {
public void syncRun()
{
run(VoidProgressMonitor.INSTANCE, false);
run(new VoidProgressMonitor(), false);
}
private class LoadFinisher implements Runnable {
......
......@@ -187,7 +187,7 @@ public class DataSourceHandler
// Save users
for (DBPDataSourceUser user : dataSourceContainer.getUsers()) {
if (user instanceof ISaveablePart) {
if (!SaveChangesHandler.validateAndSave(VoidProgressMonitor.INSTANCE, (ISaveablePart) user)) {
if (!SaveChangesHandler.validateAndSave(new VoidProgressMonitor(), (ISaveablePart) user)) {
return;
}
}
......
......@@ -65,7 +65,7 @@ public class NavigatorHandlerObjectMove extends NavigatorHandlerObjectBase {
try {
// Sibling objects - they are involved in reordering process
List<DBSObject> siblingObjects = new ArrayList<>();
for (DBNNode siblingNode : node.getParentNode().getChildren(VoidProgressMonitor.INSTANCE)) {
for (DBNNode siblingNode : node.getParentNode().getChildren(new VoidProgressMonitor())) {
if (siblingNode instanceof DBNDatabaseNode) {
DBSObject siblingObject = ((DBNDatabaseNode) siblingNode).getObject();
if (siblingObject.getClass() != object.getClass()) {
......
......@@ -65,7 +65,7 @@ public class NavigatorHandlerObjectRename extends NavigatorHandlerObjectBase {
if (node.supportsRename()) {
try {
// Rename with null monitor because it is some local resource
node.rename(VoidProgressMonitor.INSTANCE, newName);
node.rename(new VoidProgressMonitor(), newName);
return true;
/*
final String newNodeName = newName;
......
......@@ -171,7 +171,7 @@ public abstract class NodeListControl extends ObjectListControl<DBNNode> impleme
if (parentElement instanceof DBNDatabaseNode) {
try {
// Read children with void progress monitor because inline children SHOULD be already cached
DBNNode[] children = NavigatorUtils.getNodeChildrenFiltered(VoidProgressMonitor.INSTANCE, (DBNDatabaseNode)parentElement, false);
DBNNode[] children = NavigatorUtils.getNodeChildrenFiltered(new VoidProgressMonitor(), (DBNDatabaseNode)parentElement, false);
if (ArrayUtils.isEmpty(children)) {
return null;
} else {
......
......@@ -1178,7 +1178,7 @@ public abstract class ObjectListControl<OBJECT_TYPE> extends ProgressPageControl
for (int i = 0; i < columnsCount; i++) {
ObjectPropertyDescriptor property = getColumnByIndex(i).getProperty(object);
try {
Object cellValue = property == null ? null : property.readValue(object, VoidProgressMonitor.INSTANCE);
Object cellValue = property == null ? null : property.readValue(object, new VoidProgressMonitor());
if (i > 0) buf.append("\t");
String strValue = DBValueFormatting.getDefaultValueDisplayString(cellValue, DBDDisplayFormat.UI);
if (strValue.contains("\n") || strValue.contains("\t")) {
......
......@@ -47,7 +47,7 @@ public class CollectionElementData {
for (int i = 0; i < count; i++) {
elements[i] = new DBDAttributeBindingElement(collectionBinding, collection, i);
}
try (DBCSession session = DBUtils.openMetaSession(VoidProgressMonitor.INSTANCE, collectionBinding.getDataSource(), "Collection types read")) {
try (DBCSession session = DBUtils.openMetaSession(new VoidProgressMonitor(), collectionBinding.getDataSource(), "Collection types read")) {
Object[] row = new Object[1];
List<Object[]> rows = Collections.singletonList(row);
for (int i = 0; i < count; i++) {
......
......@@ -379,7 +379,7 @@ public class ResultSetUtils
{
DBPDataSource dataSource = attribute.getDataSource();
Clipboard clipboard = new Clipboard(Display.getCurrent());
try (DBCSession session = DBUtils.openUtilSession(VoidProgressMonitor.INSTANCE, dataSource, "Copy from clipboard")) {
try (DBCSession session = DBUtils.openUtilSession(new VoidProgressMonitor(), dataSource, "Copy from clipboard")) {
String strValue = (String) clipboard.getContents(TextTransfer.getInstance());
return attribute.getValueHandler().getValueFromObject(
session, attribute.getAttribute(), strValue, true);
......
......@@ -2527,7 +2527,7 @@ public class ResultSetViewer extends Viewer
// Add new row
// Copy cell values in new context
try (DBCSession session = executionContext.openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, CoreMessages.controls_resultset_viewer_add_new_row_context_name)) {
try (DBCSession session = executionContext.openSession(new VoidProgressMonitor(), DBCExecutionPurpose.UTIL, CoreMessages.controls_resultset_viewer_add_new_row_context_name)) {
final DBDAttributeBinding docAttribute = model.getDocumentAttribute();
final DBDAttributeBinding[] attributes = model.getAttributes();
......
......@@ -95,7 +95,7 @@ class ValidateUniqueKeyUsageDialog extends MessageDialogWithToggle {
{
// Edit custom key
try {
if (viewer.editEntityIdentifier(VoidProgressMonitor.INSTANCE)) {
if (viewer.editEntityIdentifier(new VoidProgressMonitor())) {
super.buttonPressed(IDialogConstants.OK_ID);
}
} catch (DBException e) {
......@@ -122,7 +122,7 @@ class ValidateUniqueKeyUsageDialog extends MessageDialogWithToggle {
try {
identifier.reloadAttributes(
VoidProgressMonitor.INSTANCE,
new VoidProgressMonitor(),
viewer.getModel().getAttributes());
} catch (DBException e) {
UIUtils.showErrorDialog(shell, "Use All Columns", "Can't reload unique columns", e);
......
......@@ -484,7 +484,7 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
if (rowNum < 0) {
return;
}
try (DBCSession session = DBUtils.openUtilSession(VoidProgressMonitor.INSTANCE, dataSource, "Advanced paste")) {
try (DBCSession session = DBUtils.openUtilSession(new VoidProgressMonitor(), dataSource, "Advanced paste")) {
String[][] newLines = parseGridLines(strValue);
// Create new rows on demand
......
......@@ -97,11 +97,11 @@ public class ContentInlineEditor extends BaseValueEditor<Text> {
try {
if (isText) {
content.updateContents(
VoidProgressMonitor.INSTANCE,
new VoidProgressMonitor(),
new StringContentStorage(newValue));
} else {
content.updateContents(
VoidProgressMonitor.INSTANCE,
new VoidProgressMonitor(),
new BytesContentStorage(newValue.getBytes(GeneralUtils.getDefaultFileEncoding()), GeneralUtils.getDefaultFileEncoding()));
}
} catch (Exception e) {
......
......@@ -17,6 +17,7 @@
package org.jkiss.dbeaver.ui.data.editors;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IContributionManager;
......@@ -42,6 +43,7 @@ import org.jkiss.dbeaver.model.data.DBDContent;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress;
import org.jkiss.dbeaver.model.runtime.DefaultProgressMonitor;
import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
......@@ -122,7 +124,7 @@ public class ContentPanelEditor extends BaseValueEditor<Control> implements IAda
log.warn("NULL content editor.");
} else {
try {
streamEditor.extractEditorValue(VoidProgressMonitor.INSTANCE, control, content);
streamEditor.extractEditorValue(new VoidProgressMonitor(), control, content);
} catch (Throwable e) {
log.debug(e);
valueController.showMessage(e.getMessage(), DBPMessageType.ERROR);
......@@ -274,9 +276,12 @@ public class ContentPanelEditor extends BaseValueEditor<Control> implements IAda
public void widgetSelected(SelectionEvent e) {
for (MenuItem item : menu.getItems()) {
if (item.getSelection()) {
StreamValueManagerDescriptor newManager = (StreamValueManagerDescriptor) item.getData();
if (newManager != curStreamManager) {
setStreamManager(newManager);
Object itemData = item.getData();
if (itemData instanceof StreamValueManagerDescriptor) {
StreamValueManagerDescriptor newManager = (StreamValueManagerDescriptor) itemData;
if (newManager != curStreamManager) {
setStreamManager(newManager);
}
}
}
}
......
......@@ -53,7 +53,7 @@ public class DateTimeInlineEditor extends BaseValueEditor<Control> {
@Override
public Object extractEditorValue() throws DBException {
try (DBCSession session = valueController.getExecutionContext().openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Make datetime value from editor")) {
try (DBCSession session = valueController.getExecutionContext().openSession(new VoidProgressMonitor(), DBCExecutionPurpose.UTIL, "Make datetime value from editor")) {
final String strValue = timeEditor.getValue();
return valueController.getValueHandler().getValueFromObject(session, valueController.getValueType(), strValue, false);
}
......
......@@ -98,7 +98,7 @@ public class ReferenceValueEditor {
try {
DBSEntityAttribute entityAttribute = binding.getEntityAttribute();
if (entityAttribute != null) {
List<DBSEntityReferrer> refs = DBUtils.getAttributeReferrers(VoidProgressMonitor.INSTANCE, entityAttribute);
List<DBSEntityReferrer> refs = DBUtils.getAttributeReferrers(new VoidProgressMonitor(), entityAttribute);
DBSEntityReferrer constraint = refs.isEmpty() ? null : refs.get(0);
if (constraint instanceof DBSEntityAssociation &&
((DBSEntityAssociation)constraint).getReferencedConstraint() instanceof DBSConstraintEnumerable)
......
......@@ -62,7 +62,7 @@ public class StringInlineEditor extends BaseValueEditor<Text> {
@Override
public Object extractEditorValue() throws DBCException {
try (DBCSession session = valueController.getExecutionContext().openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Make string value from editor")) {
try (DBCSession session = valueController.getExecutionContext().openSession(new VoidProgressMonitor(), DBCExecutionPurpose.UTIL, "Make string value from editor")) {
return valueController.getValueHandler().getValueFromObject(
session,
valueController.getValueType(),
......
......@@ -48,7 +48,7 @@ public abstract class BaseValueManager implements IValueManager {
throw new DBCException(CoreMessages.editors_sql_status_not_connected_to_database);
}
// We are going to create NULL value - it shouldn't result in any DB roundtrips so let's use dummy monitor
try (DBCSession session = executionContext.openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Set NULL value")) {
try (DBCSession session = executionContext.openSession(new VoidProgressMonitor(), DBCExecutionPurpose.UTIL, "Set NULL value")) {
return DBUtils.makeNullValue(
session,
valueController.getValueHandler(),
......
......@@ -79,6 +79,10 @@ public class XMLPanelEditor extends AbstractTextPanelEditor {
@Override
public void extractEditorValue(@NotNull DBRProgressMonitor monitor, @NotNull StyledText control, @NotNull DBDContent value) throws DBException
{
if (!editor.isDirty()) {
return;
}
monitor.beginTask("Read XML value", 1);
try {
monitor.subTask("Read XML value");
......
......@@ -325,7 +325,7 @@ public class ComplexObjectEditor extends TreeViewer {
final ComplexElement[] items = childrenMap.get(complexValue);
if (complexValue instanceof DBDValueCloneable) {
try {
complexValue = (DBDComplexValue) ((DBDValueCloneable) complexValue).cloneValue(VoidProgressMonitor.INSTANCE);
complexValue = (DBDComplexValue) ((DBDValueCloneable) complexValue).cloneValue(new VoidProgressMonitor());
} catch (DBCException e) {
log.error("Error cloning complex value", e);
}
......
......@@ -260,7 +260,7 @@ public class TextViewDialog extends ValueViewDialog {
}
}
try (DBCSession session = getValueController().getExecutionContext().openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Make text value from editor")) {
try (DBCSession session = getValueController().getExecutionContext().openSession(new VoidProgressMonitor(), DBCExecutionPurpose.UTIL, "Make text value from editor")) {
return getValueController().getValueHandler().getValueFromObject(
session,
getValueController().getValueType(),
......
......@@ -51,7 +51,7 @@ public class NodeEditorInputFactory implements IElementFactory
final DBNModel navigatorModel = DBeaverCore.getInstance().getNavigatorModel();
try {
final DBNNode node = navigatorModel.getNodeByPath(VoidProgressMonitor.INSTANCE, nodePath);
final DBNNode node = navigatorModel.getNodeByPath(new VoidProgressMonitor(), nodePath);
if (node != null) {
return new NodeEditorInput(node);
}
......
......@@ -828,7 +828,7 @@ public class EntityEditor extends MultiPageDatabaseEditor
}
breadcrumbsMenu = new Menu(item.getParent().getShell());
try {
final DBNNode[] childNodes = NavigatorUtils.getNodeChildrenFiltered(VoidProgressMonitor.INSTANCE, databaseNode, false);
final DBNNode[] childNodes = NavigatorUtils.getNodeChildrenFiltered(new VoidProgressMonitor(), databaseNode, false);
if (!ArrayUtils.isEmpty(childNodes)) {
for (final DBNNode folderItem : childNodes) {
MenuItem childItem = new MenuItem(breadcrumbsMenu, SWT.NONE);
......
......@@ -169,7 +169,7 @@ public class FolderEditor extends EditorPart implements INavigatorModelView, IRe
}
String nodePath = history.get(position);
try {
DBNNode node = DBeaverCore.getInstance().getNavigatorModel().getNodeByPath(VoidProgressMonitor.INSTANCE, nodePath);
DBNNode node = DBeaverCore.getInstance().getNavigatorModel().getNodeByPath(new VoidProgressMonitor(), nodePath);
if (node != null) {
historyPosition = position;
itemControl.changeCurrentNode(node);
......
......@@ -463,7 +463,7 @@ public class ObjectPropertiesEditor extends AbstractDatabaseObjectEditor<DBSObje
if (node.needsInitialization()) {
DBeaverUI.runInProgressService(tabsCollector);
} else {
tabsCollector.run(VoidProgressMonitor.INSTANCE);
tabsCollector.run(new VoidProgressMonitor());
}
} catch (InvocationTargetException e) {
log.error(e.getTargetException());
......
......@@ -123,6 +123,6 @@ public class AttributeEditPage extends BaseObjectEditPage {
@Override
protected void performFinish() throws DBException {
//commandContext.saveChanges(VoidProgressMonitor.INSTANCE);
//commandContext.saveChanges(new VoidProgressMonitor());
}
}
......@@ -77,7 +77,7 @@ public class EditConstraintPage extends AttributesSelectorPage {
this.constraint = constraint;
this.constraintTypes = new DBSEntityConstraintType[] {constraint.getConstraintType()};
try {
this.attributes = constraint.getAttributeReferences(VoidProgressMonitor.INSTANCE);
this.attributes = constraint.getAttributeReferences(new VoidProgressMonitor());
} catch (DBException e) {
UIUtils.showErrorDialog(null, "Can't get attributes", "Error obtaining entity attributes", e);
}
......
......@@ -262,7 +262,7 @@ public class EditForeignKeyPage extends BaseObjectEditPage {
schemaCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
DBNDatabaseNode selectedNode = null;
for (DBNNode node : schemaContainerNode.getChildren(VoidProgressMonitor.INSTANCE)) {
for (DBNNode node : schemaContainerNode.getChildren(new VoidProgressMonitor())) {
if (node instanceof DBNDatabaseNode && ((DBNDatabaseNode) node).getObject() instanceof DBSObjectContainer) {
schemaCombo.addItem((DBNDatabaseNode) node);
if (((DBNDatabaseNode) node).getObject() == ownTable.getParentObject()) {
......@@ -287,7 +287,7 @@ public class EditForeignKeyPage extends BaseObjectEditPage {
newContainerNode = schemaNode;
} else {
try {
for (DBNNode child : schemaNode.getChildren(VoidProgressMonitor.INSTANCE)) {
for (DBNNode child : schemaNode.getChildren(new VoidProgressMonitor())) {
if (child instanceof DBNDatabaseNode && ((DBNDatabaseNode) child).getMeta() == tableContainerMeta) {
newContainerNode = (DBNDatabaseNode) child;
break;
......@@ -389,13 +389,13 @@ public class EditForeignKeyPage extends BaseObjectEditPage {
curConstraint = curConstraints.get(uniqueKeyCombo.getSelectionIndex());
try {
// Read column nodes with void monitor because we already cached them above
for (DBSEntityAttributeRef pkColumn : curConstraint.getAttributeReferences(VoidProgressMonitor.INSTANCE)) {
for (DBSEntityAttributeRef pkColumn : curConstraint.getAttributeReferences(new VoidProgressMonitor())) {
FKColumnInfo fkColumnInfo = new FKColumnInfo(pkColumn.getAttribute());
// Try to find matched column in own table
Collection<? extends DBSEntityAttribute> tmpColumns = ownTable.getAttributes(VoidProgressMonitor.INSTANCE);
Collection<? extends DBSEntityAttribute> tmpColumns = ownTable.getAttributes(new VoidProgressMonitor());
ownColumns = tmpColumns == null ?
Collections.<DBSTableColumn>emptyList() :
new ArrayList<>(ownTable.getAttributes(VoidProgressMonitor.INSTANCE));
new ArrayList<>(ownTable.getAttributes(new VoidProgressMonitor()));
if (!CommonUtils.isEmpty(ownColumns)) {
for (DBSEntityAttribute ownColumn : ownColumns) {
if (ownColumn.getName().equals(pkColumn.getAttribute().getName()) && ownTable != pkColumn.getAttribute().getParentObject()) {
......
......@@ -143,7 +143,7 @@ public class SQLInformationProvider implements IInformationProvider, IInformatio
DBSObject object = null;
if (informer.hasObjects()) {
// Make object description
DBRProgressMonitor monitor = VoidProgressMonitor.INSTANCE;
DBRProgressMonitor monitor = new VoidProgressMonitor();
final DBSObjectReference objectRef = informer.getObjectReferences().get(0);
try {
......
......@@ -537,7 +537,7 @@ public class NavigatorUtils {
return true;
}
try {
selector.setDefaultObject(VoidProgressMonitor.INSTANCE, dbObject);
selector.setDefaultObject(new VoidProgressMonitor(), dbObject);
} catch (Throwable e) {
log.debug(e);
}
......
......@@ -114,7 +114,7 @@ public class CheckboxTreeManager implements ICheckStateListener {
}
for (DBNDatabaseNode container : change ? targetContainers : Collections.singletonList((DBNDatabaseNode) element)) {
try {
DBNDatabaseNode[] directChildren = container.getChildren(VoidProgressMonitor.INSTANCE);
DBNDatabaseNode[] directChildren = container.getChildren(new VoidProgressMonitor());
if (directChildren != null) {
boolean missingOne = false, missingAll = true;
for (DBNDatabaseNode node : directChildren) {
......
......@@ -117,7 +117,7 @@ class DatabaseNavigatorContentProvider implements IStructuredContentProvider, IT
// Read children with null monitor cos' it's not a lazy node
// and no blocking process will occur
DBNNode[] children = NavigatorUtils.getNodeChildrenFiltered(
VoidProgressMonitor.INSTANCE, parentNode, true);
new VoidProgressMonitor(), parentNode, true);
if (ArrayUtils.isEmpty(children)) {
return EMPTY_CHILDREN;
} else {
......
......@@ -71,7 +71,7 @@ public abstract class AbstractSearchResultsPage <OBJECT_TYPE> extends Page imple
DBeaverUI.syncExec(new Runnable() {
@Override
public void run() {
populateObjects(VoidProgressMonitor.INSTANCE, newObjects);
populateObjects(new VoidProgressMonitor(), newObjects);
}
});
}
......
......@@ -230,7 +230,7 @@ public class DB2Utils {
public static String getMessageFromCode(DB2DataSource db2DataSource, Integer sqlErrorCode) throws SQLException
{
try (JDBCSession session = DBUtils.openUtilSession(VoidProgressMonitor.INSTANCE, db2DataSource, "Get Error Code")) {
try (JDBCSession session = DBUtils.openUtilSession(new VoidProgressMonitor(), db2DataSource, "Get Error Code")) {
return JDBCUtils.queryString(session, GET_MSG, sqlErrorCode);
}
}
......
......@@ -105,20 +105,20 @@ public class DB2TableManager extends SQLTableManager<DB2Table, DB2Schema> implem
try {
// Add Tablespaces infos
if (db2Table.getTablespace(VoidProgressMonitor.INSTANCE) != null) {
if (db2Table.getTablespace(new VoidProgressMonitor()) != null) {
ddl.append(LINE_SEPARATOR);
ddl.append(CLAUSE_IN_TS);
ddl.append(getTablespaceName(db2Table.getTablespace(VoidProgressMonitor.INSTANCE)));
ddl.append(getTablespaceName(db2Table.getTablespace(new VoidProgressMonitor())));
}
if (db2Table.getIndexTablespace(VoidProgressMonitor.INSTANCE) != null) {
if (db2Table.getIndexTablespace(new VoidProgressMonitor()) != null) {
ddl.append(LINE_SEPARATOR);
ddl.append(CLAUSE_IN_TS_IX);
ddl.append(getTablespaceName(db2Table.getIndexTablespace(VoidProgressMonitor.INSTANCE)));
ddl.append(getTablespaceName(db2Table.getIndexTablespace(new VoidProgressMonitor())));
}
if (db2Table.getLongTablespace(VoidProgressMonitor.INSTANCE) != null) {
if (db2Table.getLongTablespace(new VoidProgressMonitor()) != null) {
ddl.append(LINE_SEPARATOR);
ddl.append(CLAUSE_IN_TS_LONG);
ddl.append(getTablespaceName(db2Table.getLongTablespace(VoidProgressMonitor.INSTANCE)));
ddl.append(getTablespaceName(db2Table.getLongTablespace(new VoidProgressMonitor())));
}
} catch (DBException e) {
// Never be here
......
......@@ -334,7 +334,7 @@ public class DB2DataSource extends JDBCDataSource implements DBSObjectSelector,
public Collection<DB2DataType> getLocalDataTypes()
{
try {
return getDataTypes(VoidProgressMonitor.INSTANCE);
return getDataTypes(new VoidProgressMonitor());
} catch (DBException e) {
LOG.error("DBException occurred when reading system dataTypes: ", e);
return null;
......@@ -345,7 +345,7 @@ public class DB2DataSource extends JDBCDataSource implements DBSObjectSelector,
public DB2DataType getLocalDataType(String typeName)
{
try {
return getDataType(VoidProgressMonitor.INSTANCE, typeName);
return getDataType(new VoidProgressMonitor(), typeName);
} catch (DBException e) {
LOG.error("DBException occurred when reading system dataTYpe : " + typeName, e);
return null;
......
......@@ -134,7 +134,7 @@ public class DB2DataType extends DB2Object<DBSObject> implements DBSDataType, DB
this.db2Schema = ((DB2Module) owner).getSchema();
String typeModuleName = JDBCUtils.safeGetStringTrimmed(dbResult, "TYPEMODULENAME");
if (typeModuleName != null) {
this.db2Module = DB2Utils.findModuleBySchemaNameAndName(VoidProgressMonitor.INSTANCE, db2DataSource,
this.db2Module = DB2Utils.findModuleBySchemaNameAndName(new VoidProgressMonitor(), db2DataSource,
db2Schema.getName(), typeModuleName);
}
......@@ -142,7 +142,7 @@ public class DB2DataType extends DB2Object<DBSObject> implements DBSDataType, DB
// System datatypes
String schemaName = JDBCUtils.safeGetStringTrimmed(dbResult, "TYPESCHEMA");
try {
this.db2Schema = db2DataSource.getSchema(VoidProgressMonitor.INSTANCE, schemaName);
this.db2Schema = db2DataSource.getSchema(new VoidProgressMonitor(), schemaName);
} catch (DBException e) {
LOG.error("Impossible! Schema '" + schemaName + "' for dataType '" + name + "' not found??", e);
// In this case, 'this.db2Schema' will be null...
......
......@@ -102,7 +102,7 @@ public class DB2Package extends DB2SchemaObject implements DBPRefreshableObject
this.owner = JDBCUtils.safeGetString(dbResult, "OWNER");
String defaultSchemaName = JDBCUtils.safeGetStringTrimmed(dbResult, "DEFAULT_SCHEMA");
this.defaultSchema = getDataSource().getSchema(VoidProgressMonitor.INSTANCE, defaultSchemaName);
this.defaultSchema = getDataSource().getSchema(new VoidProgressMonitor(), defaultSchemaName);
this.uniqueId = JDBCUtils.safeGetString(dbResult, "UNIQUE_ID");
this.valid = JDBCUtils.safeGetBoolean(dbResult, "VALID", DB2YesNo.Y.name());
......
......@@ -89,10 +89,10 @@ public class DB2TablePartition extends DB2Object<DB2Table> {
// Lookup tablespaces
Integer tablespaceId = JDBCUtils.safeGetInteger(dbResult, "TBSPACEID");
this.tablespace = DB2Utils.findTablespaceById(VoidProgressMonitor.INSTANCE, db2Table.getDataSource(), tablespaceId);
this.tablespace = DB2Utils.findTablespaceById(new VoidProgressMonitor(), db2Table.getDataSource(), tablespaceId);
Integer longTablespaceId = JDBCUtils.safeGetInteger(dbResult, "LONG_TBSPACEID");
this.indexTablespace = DB2Utils
.findTablespaceById(VoidProgressMonitor.INSTANCE, db2Table.getDataSource(), longTablespaceId);
.findTablespaceById(new VoidProgressMonitor(), db2Table.getDataSource(), longTablespaceId);
if (db2DataSource.isAtLeastV9_7()) {
this.statsTime = JDBCUtils.safeGetTimestamp(dbResult, "STATS_TIME");
this.card = JDBCUtils.safeGetLongNullable(dbResult, "CARD");
......@@ -101,7 +101,7 @@ public class DB2TablePartition extends DB2Object<DB2Table> {
this.overFLow = JDBCUtils.safeGetLongNullable(dbResult, "OVERFLOW");
this.lastUsed = JDBCUtils.safeGetDate(dbResult, "LASTUSED");
Integer indexTablespaceId = JDBCUtils.safeGetInteger(dbResult, "INDEX_TBSPACEID");
this.longTablespace = DB2Utils.findTablespaceById(VoidProgressMonitor.INSTANCE, db2Table.getDataSource(),
this.longTablespace = DB2Utils.findTablespaceById(new VoidProgressMonitor(), db2Table.getDataSource(),
indexTablespaceId);
}
}
......
......@@ -58,7 +58,7 @@ public class DB2TablePeriod extends DB2Object<DB2Table> {
this.type = CommonUtils.valueOf(DB2PeriodType.class, JDBCUtils.safeGetString(dbResult, "PERIODTYPE"));
// Lookup related objects
VoidProgressMonitor vpm = VoidProgressMonitor.INSTANCE;
VoidProgressMonitor vpm = new VoidProgressMonitor();
beginColumn = db2Table.getAttribute(vpm, beginColumnName);
endColumn = db2Table.getAttribute(vpm, endColumnName);
historyTableSchema = db2DataSource.getSchema(vpm, historyTabSchemaName.trim());
......
......@@ -117,12 +117,12 @@ public class DB2Tablespace extends DB2GlobalObject implements DBPNamedObject, DB
String storageGroupName = JDBCUtils.safeGetString(dbResult, "SGNAME");
if (storageGroupName != null) {
this.storageGroup = db2DataSource.getStorageGroup(VoidProgressMonitor.INSTANCE, storageGroupName);
this.storageGroup = db2DataSource.getStorageGroup(new VoidProgressMonitor(), storageGroupName);
}
}
Integer bufferpoolId = JDBCUtils.safeGetInteger(dbResult, "BUFFERPOOLID");
bufferpool = DB2Utils.findBufferpoolById(VoidProgressMonitor.INSTANCE, db2DataSource, bufferpoolId);
bufferpool = DB2Utils.findBufferpoolById(new VoidProgressMonitor(), db2DataSource, bufferpoolId);
}
......
......@@ -74,7 +74,7 @@ public class DB2Variable extends DB2Object<DBSObject> {
db2Schema = ((DB2Module) owner).getSchema();
} else {
String schemaName = JDBCUtils.safeGetStringTrimmed(dbResult, "VARSCHEMA");
this.db2Schema = ((DB2DataSource) owner).getSchema(VoidProgressMonitor.INSTANCE, schemaName);
this.db2Schema = ((DB2DataSource) owner).getSchema(new VoidProgressMonitor(), schemaName);
}
}
......
......@@ -63,7 +63,7 @@ public class DB2RemoteServer extends DB2GlobalObject implements DBPRefreshableOb
String db2WrapperName = JDBCUtils.safeGetString(dbResult, "WRAPNAME");
if (db2WrapperName != null) {
this.db2Wrapper = getDataSource().getWrapper(VoidProgressMonitor.INSTANCE, db2WrapperName);
this.db2Wrapper = getDataSource().getWrapper(new VoidProgressMonitor(), db2WrapperName);
}
}
......
......@@ -48,7 +48,7 @@ public class DB2UserMapping extends DB2GlobalObject {
this.authId = JDBCUtils.safeGetStringTrimmed(dbResult, "AUTHID");
String remoteServerName = JDBCUtils.safeGetStringTrimmed(dbResult, "SERVERNAME");
remoteServer = db2DataSource.getRemoteServer(VoidProgressMonitor.INSTANCE, remoteServerName);
remoteServer = db2DataSource.getRemoteServer(new VoidProgressMonitor(), remoteServerName);
}
......
......@@ -61,7 +61,7 @@ public class DB2Role extends DB2Grantee implements DBPSaveableObject, DBARole, D
public DB2Role(DB2DataSource db2DataSource, ResultSet resultSet)
{
super(VoidProgressMonitor.INSTANCE, db2DataSource, resultSet, "ROLENAME");
super(new VoidProgressMonitor(), db2DataSource, resultSet, "ROLENAME");
this.id = JDBCUtils.safeGetInteger(resultSet, "ROLEID");
this.createTime = JDBCUtils.safeGetTimestamp(resultSet, "CREATE_TIME");
......
......@@ -52,13 +52,13 @@ public class DB2RoleDep extends DB2Object<DB2Role> implements DBAPrivilege {
String granteeName = JDBCUtils.safeGetStringTrimmed(resultSet, "GRANTEE");
switch (granteeType) {
case U:
this.grantee = getDataSource().getUser(VoidProgressMonitor.INSTANCE, granteeName);
this.grantee = getDataSource().getUser(new VoidProgressMonitor(), granteeName);
break;
case G:
this.grantee = getDataSource().getGroup(VoidProgressMonitor.INSTANCE, granteeName);
this.grantee = getDataSource().getGroup(new VoidProgressMonitor(), granteeName);
break;
case R:
this.grantee = getDataSource().getRole(VoidProgressMonitor.INSTANCE, granteeName);
this.grantee = getDataSource().getRole(new VoidProgressMonitor(), granteeName);
break;
default:
......
......@@ -488,7 +488,7 @@ public class DiagramLoader
if (association instanceof ERDLogicalForeignKey) {
// Save columns
for (DBSEntityAttributeRef column : ((ERDLogicalForeignKey) association).getAttributeReferences(VoidProgressMonitor.INSTANCE)) {
for (DBSEntityAttributeRef column : ((ERDLogicalForeignKey) association).getAttributeReferences(new VoidProgressMonitor())) {
xml.startElement(TAG_COLUMN);
xml.addAttribute(ATTR_NAME, column.getAttribute().getName());
try {
......
......@@ -126,7 +126,7 @@ public class ERDAssociation extends ERDObject<DBSEntityAssociation>
if (identifying == null) {
identifying = false;
try {
identifying = DBUtils.isIdentifyingAssociation(VoidProgressMonitor.INSTANCE, getObject());
identifying = DBUtils.isIdentifyingAssociation(new VoidProgressMonitor(), getObject());
} catch (DBException e) {
log.debug(e);
}
......
......@@ -194,10 +194,10 @@ public class AssociationPart extends PropertyAwareConnectionPart {
if (association instanceof DBSEntityReferrer && association.getReferencedConstraint() instanceof DBSEntityReferrer) {
List<AttributePart> sourceAttributes = getEntityAttributes(
(EntityPart)getSource(),
DBUtils.getEntityAttributes(VoidProgressMonitor.INSTANCE, (DBSEntityReferrer) association.getReferencedConstraint()));
DBUtils.getEntityAttributes(new VoidProgressMonitor(), (DBSEntityReferrer) association.getReferencedConstraint()));
List<AttributePart> targetAttributes = getEntityAttributes(
(EntityPart)getTarget(),
DBUtils.getEntityAttributes(VoidProgressMonitor.INSTANCE, (DBSEntityReferrer) association));
DBUtils.getEntityAttributes(new VoidProgressMonitor(), (DBSEntityReferrer) association));
Color columnColor = value != EditPart.SELECTED_NONE ? Display.getDefault().getSystemColor(SWT.COLOR_RED) : getViewer().getControl().getForeground();
for (AttributePart attr : sourceAttributes) {
attr.getFigure().setForegroundColor(columnColor);
......
......@@ -54,9 +54,9 @@ public class ExasolBaseObjectGrant implements DBAPrivilege {
String grants = JDBCUtils.safeGetString(resultSet, "PRIVS");
if (type == ExasolTableObjectType.SCHEMA)
{
this.schema = dataSource.getChild(VoidProgressMonitor.INSTANCE, JDBCUtils.safeGetString(resultSet, "OBJECT_NAME"));
this.schema = dataSource.getChild(new VoidProgressMonitor(), JDBCUtils.safeGetString(resultSet, "OBJECT_NAME"));
} else {
this.schema = dataSource.getChild(VoidProgressMonitor.INSTANCE, JDBCUtils.safeGetString(resultSet, "OBJECT_SCHEMA"));
this.schema = dataSource.getChild(new VoidProgressMonitor(), JDBCUtils.safeGetString(resultSet, "OBJECT_SCHEMA"));
}
this.name = JDBCUtils.safeGetString(resultSet, "OBJECT_NAME");
......
......@@ -50,7 +50,7 @@ public class ExasolConnectionGrant
@Property(viewable = true, order = 10)
public ExasolConnection getConnection() throws DBException
{
return dataSource.getConnection(VoidProgressMonitor.INSTANCE, connection);
return dataSource.getConnection(new VoidProgressMonitor(), connection);
}
@Property(viewable = true, order = 90)
......
......@@ -46,7 +46,7 @@ public class ExasolRoleGrant implements DBAPrivilege {
@Property(viewable = true, order = 10)
public ExasolRole getRole() throws DBException
{
return dataSource.getRole(VoidProgressMonitor.INSTANCE, role);
return dataSource.getRole(new VoidProgressMonitor(), role);
}
@Property(viewable = true, order = 20)
......
......@@ -33,7 +33,7 @@ public class ExasolScriptGrant extends ExasolBaseObjectGrant {
@Property(viewable = true, order = 10)
public ExasolScript getProcedure() throws DBException
{
return super.getSchema().getProcedure(VoidProgressMonitor.INSTANCE, super.getObjectName());
return super.getSchema().getProcedure(new VoidProgressMonitor(), super.getObjectName());
}
@Override
......
......@@ -34,7 +34,7 @@ public class ExasolTableGrant extends ExasolBaseObjectGrant {
@Property(viewable = true, order = 10)
public ExasolTable getTable() throws DBException
{
return super.getSchema().getTable(VoidProgressMonitor.INSTANCE, super.getObjectName());
return super.getSchema().getTable(new VoidProgressMonitor(), super.getObjectName());
}
......
......@@ -32,7 +32,7 @@ public class ExasolViewGrant extends ExasolBaseObjectGrant {
@Property(viewable = true, order = 10)
public ExasolView getView() throws DBException
{
return super.getSchema().getView(VoidProgressMonitor.INSTANCE, super.getObjectName());
return super.getSchema().getView(new VoidProgressMonitor(), super.getObjectName());
}
......
......@@ -717,7 +717,7 @@ public class ExasolDataSource extends JDBCDataSource
public Collection<? extends DBSDataType> getLocalDataTypes()
{
try {
return getDataTypes(VoidProgressMonitor.INSTANCE);
return getDataTypes(new VoidProgressMonitor());
} catch (DBException e) {
LOG.error("DBException occured when reading system dataTypes: ", e);
return null;
......@@ -776,7 +776,7 @@ public class ExasolDataSource extends JDBCDataSource
public DBSDataType getLocalDataType(String typeName)
{
try {
return getDataType(VoidProgressMonitor.INSTANCE, typeName);
return getDataType(new VoidProgressMonitor(), typeName);
} catch (DBException e) {
LOG.error("DBException occured when reading system dataType: "
+ typeName, e);
......
......@@ -289,7 +289,7 @@ public class ExasolTableColumn extends JDBCTableColumn<ExasolTableBase>
{
ExasolTableBase table = (ExasolTable) getTable();
try {
final Collection<ExasolTableUniqueKey> uniqueKeysCache = table.getConstraints(VoidProgressMonitor.INSTANCE);
final Collection<ExasolTableUniqueKey> uniqueKeysCache = table.getConstraints(new VoidProgressMonitor());
if (!CommonUtils.isEmpty(uniqueKeysCache))
{
for (ExasolTableUniqueKey key : uniqueKeysCache)
......
......@@ -73,13 +73,13 @@ public class ExasolVirtualSchema extends ExasolSchema {
@Property(viewable = true, order = 10)
public ExasolSchema getAdapterScriptSchema() throws DBException
{
return dataSource.getSchema(VoidProgressMonitor.INSTANCE, adapterScriptSchema) ;
return dataSource.getSchema(new VoidProgressMonitor(), adapterScriptSchema) ;
}
@Property(viewable = true, order = 20)
public ExasolScript getAdapterScriptName() throws DBException
{
return this.getAdapterScriptSchema().getProcedure(VoidProgressMonitor.INSTANCE, adapterScriptName);
return this.getAdapterScriptSchema().getProcedure(new VoidProgressMonitor(), adapterScriptName);
}
@Property(viewable = true, order = 30)
......@@ -102,7 +102,7 @@ public class ExasolVirtualSchema extends ExasolSchema {
public Collection<ExasolVirtualSchemaParameter> getVirtualSchemaParameters() throws DBException
{
return virtualSchemaParameterCache.getAllObjects(VoidProgressMonitor.INSTANCE, this);
return virtualSchemaParameterCache.getAllObjects(new VoidProgressMonitor(), this);
}
@Override
......
......@@ -51,7 +51,7 @@ public class ExasolExportTableTool implements IExternalTool {
//add tables for all Schemas but ignore views in schema
for(ExasolSchema schema : schemas)
{
tables.addAll(schema.getTables(VoidProgressMonitor.INSTANCE));
tables.addAll(schema.getTables(new VoidProgressMonitor()));
}
// create TableBase Objects list
......
......@@ -48,7 +48,7 @@ public class ExasolImportTableTool implements IExternalTool {
//add tables for all Schemas but ignore views in schema
for(ExasolSchema schema : schemas)
{
tables.addAll(schema.getTables(VoidProgressMonitor.INSTANCE));
tables.addAll(schema.getTables(new VoidProgressMonitor()));
}
// create TableBase Objects list
......
......@@ -215,7 +215,7 @@ public class GenericDataSource extends JDBCDataSource
if (!CommonUtils.isEmpty(paramShutdown)) {
monitor.subTask("Shutdown embedded database");
try {
final Driver driver = getDriverInstance(VoidProgressMonitor.INSTANCE); // Use void monitor - driver already loaded
final Driver driver = getDriverInstance(new VoidProgressMonitor()); // Use void monitor - driver already loaded
if (driver != null) {
driver.connect(getContainer().getActualConnectionConfiguration().getUrl() + paramShutdown, null);
}
......
......@@ -99,7 +99,7 @@ public class MySQLTableManager extends SQLTableManager<MySQLTableBase, MySQLCata
if (tableBase instanceof MySQLTable) {
MySQLTable table =(MySQLTable)tableBase;
try {
final MySQLTable.AdditionalInfo additionalInfo = table.getAdditionalInfo(VoidProgressMonitor.INSTANCE);
final MySQLTable.AdditionalInfo additionalInfo = table.getAdditionalInfo(new VoidProgressMonitor());
if ((!table.isPersisted() || tableProps.getProperty("engine") != null) && additionalInfo.getEngine() != null) { //$NON-NLS-1$
ddl.append("\nENGINE=").append(additionalInfo.getEngine().getName()); //$NON-NLS-1$
}
......
......@@ -108,7 +108,7 @@ public class OraclePackageManager extends SQLObjectEditor<OraclePackage, OracleS
private void createOrReplaceProcedureQuery(List<DBEPersistAction> actionList, OraclePackage pack)
{
try {
String header = pack.getObjectDefinitionText(VoidProgressMonitor.INSTANCE);
String header = pack.getObjectDefinitionText(new VoidProgressMonitor());
if (!CommonUtils.isEmpty(header)) {
actionList.add(
new OracleObjectValidateAction(
......@@ -116,7 +116,7 @@ public class OraclePackageManager extends SQLObjectEditor<OraclePackage, OracleS
"Create package header",
header)); //$NON-NLS-1$
}
String body = pack.getExtendedDefinitionText(VoidProgressMonitor.INSTANCE);
String body = pack.getExtendedDefinitionText(new VoidProgressMonitor());
if (!CommonUtils.isEmpty(body)) {
actionList.add(
new OracleObjectValidateAction(
......
......@@ -86,7 +86,7 @@ public class OracleTableColumnManager extends SQLTableColumnManager<OracleTableC
actionList.add(new SQLDatabasePersistAction(
"Comment column",
"COMMENT ON COLUMN " + column.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL) + "." + DBUtils.getQuotedIdentifier(column) +
" IS '" + column.getComment(VoidProgressMonitor.INSTANCE) + "'"));
" IS '" + column.getComment(new VoidProgressMonitor()) + "'"));
}
}
......
......@@ -56,7 +56,7 @@ public class SchedulerJobLogEditor extends AbstractDataEditor<OracleSchedulerJob
}
List<DBDAttributeConstraint> constraints = new ArrayList<>();
try {
DBRProgressMonitor monitor = VoidProgressMonitor.INSTANCE;
DBRProgressMonitor monitor = new VoidProgressMonitor();
OracleTableColumn ownerAttr = logView.getAttribute(monitor, "OWNER");
if (ownerAttr != null) {
DBDAttributeConstraint ac = new DBDAttributeConstraint(ownerAttr, ownerAttr.getOrdinalPosition());
......@@ -104,7 +104,7 @@ public class SchedulerJobLogEditor extends AbstractDataEditor<OracleSchedulerJob
}
private OracleTableBase getJobLogView() {
DBRProgressMonitor monitor = VoidProgressMonitor.INSTANCE;
DBRProgressMonitor monitor = new VoidProgressMonitor();
try {
OracleDataSource dataSource = getDatabaseObject().getDataSource();
......
......@@ -42,7 +42,7 @@ public class OracleTableForeignKeyColumn extends OracleTableConstraintColumn imp
{
OracleTableConstraint referencedConstraint = ((OracleTableForeignKey) getParentObject()).getReferencedConstraint();
if (referencedConstraint != null) {
List<OracleTableConstraintColumn> ar = referencedConstraint.getAttributeReferences(VoidProgressMonitor.INSTANCE);
List<OracleTableConstraintColumn> ar = referencedConstraint.getAttributeReferences(new VoidProgressMonitor());
if (ar != null) {
return ar.get(getOrdinalPosition() - 1).getAttribute();
}
......
......@@ -269,7 +269,7 @@ public abstract class OracleTablePhysical extends OracleTableBase implements DBS
{
final List<OracleTablespace> tablespaces = new ArrayList<>();
try {
for (OracleTablespace ts : object.getDataSource().getTablespaces(VoidProgressMonitor.INSTANCE)) {
for (OracleTablespace ts : object.getDataSource().getTablespaces(new VoidProgressMonitor())) {
tablespaces.add(ts);
}
} catch (DBException e) {
......
......@@ -76,7 +76,7 @@ public class PostgreSchemaManager extends SQLObjectEditor<PostgreSchema, Postgre
final PostgreSchema schema = command.getObject();
final StringBuilder script = new StringBuilder("CREATE SCHEMA " + DBUtils.getQuotedIdentifier(schema));
try {
final PostgreRole owner = schema.getOwner(VoidProgressMonitor.INSTANCE);
final PostgreRole owner = schema.getOwner(new VoidProgressMonitor());
if (owner != null) {
script.append("\nAUTHORIZATION ").append(owner.getName());
}
......
......@@ -104,7 +104,7 @@ public class PostgreTableManager extends SQLTableManager<PostgreTableBase, Postg
protected void appendTableModifiers(PostgreTableBase tableBase, NestedObjectCommand tableProps, StringBuilder ddl)
{
if (tableBase instanceof PostgreTableRegular) {
final VoidProgressMonitor monitor = VoidProgressMonitor.INSTANCE;
final VoidProgressMonitor monitor = new VoidProgressMonitor();
PostgreTableRegular table =(PostgreTableRegular)tableBase;
try {
final List<PostgreTableInheritance> superTables = table.getSuperInheritance(monitor);
......
......@@ -166,7 +166,7 @@ class PostgreBackupWizardPageObjects extends PostgreWizardPageSettings<PostgreBa
if (dataSource != null) {
boolean tablesLoaded = false;
try {
for (PostgreSchema schema : dataSource.getDefaultInstance().getSchemas(VoidProgressMonitor.INSTANCE)) {
for (PostgreSchema schema : dataSource.getDefaultInstance().getSchemas(new VoidProgressMonitor())) {
if (schema.isSystem() || schema.isUtility()) {
continue;
}
......
......@@ -168,7 +168,7 @@ public class JDBCCollection implements DBDCollection, DBDValueCloneable {
attrs[i] = attr;
}
final DBSDataType dataType = getComponentType();
try (DBCSession session = DBUtils.openUtilSession(VoidProgressMonitor.INSTANCE, dataType.getDataSource(), "Create JDBC array")) {
try (DBCSession session = DBUtils.openUtilSession(new VoidProgressMonitor(), dataType.getDataSource(), "Create JDBC array")) {
if (session instanceof Connection) {
return ((Connection) session).createArrayOf(dataType.getTypeName(), attrs);
} else {
......
......@@ -120,7 +120,7 @@ public abstract class JDBCComposite implements DBDComposite, DBDValueCloneable {
attrs[i] = attr;
}
final DBSDataType dataType = getDataType();
try (DBCSession session = DBUtils.openUtilSession(VoidProgressMonitor.INSTANCE, dataType.getDataSource(), "Create JDBC struct")) {
try (DBCSession session = DBUtils.openUtilSession(new VoidProgressMonitor(), dataType.getDataSource(), "Create JDBC struct")) {
if (session instanceof Connection) {
return ((Connection) session).createStruct(dataType.getTypeName(), attrs);
} else {
......
......@@ -100,7 +100,7 @@ public abstract class SQLConstraintManager<OBJECT_TYPE extends JDBCTableConstrai
decl.append(" ("); //$NON-NLS-1$
// Get columns using void monitor
try {
List<? extends DBSEntityAttributeRef> attrs = command.getObject().getAttributeReferences(VoidProgressMonitor.INSTANCE);
List<? extends DBSEntityAttributeRef> attrs = command.getObject().getAttributeReferences(new VoidProgressMonitor());
if (attrs != null) {
boolean firstColumn = true;
for (DBSEntityAttributeRef constraintColumn : attrs) {
......
......@@ -94,7 +94,7 @@ public abstract class SQLForeignKeyManager<OBJECT_TYPE extends JDBCTableConstrai
.append(" ("); //$NON-NLS-1$
try {
// Get columns using void monitor
final Collection<? extends DBSEntityAttributeRef> columns = command.getObject().getAttributeReferences(VoidProgressMonitor.INSTANCE);
final Collection<? extends DBSEntityAttributeRef> columns = command.getObject().getAttributeReferences(new VoidProgressMonitor());
boolean firstColumn = true;
for (DBSEntityAttributeRef constraintColumn : CommonUtils.safeCollection(columns)) {
final DBSEntityAttribute attribute = constraintColumn.getAttribute();
......@@ -112,7 +112,7 @@ public abstract class SQLForeignKeyManager<OBJECT_TYPE extends JDBCTableConstrai
if (refConstraint instanceof DBSEntityReferrer) {
try {
boolean firstColumn = true;
List<? extends DBSEntityAttributeRef> columns = ((DBSEntityReferrer) refConstraint).getAttributeReferences(VoidProgressMonitor.INSTANCE);
List<? extends DBSEntityAttributeRef> columns = ((DBSEntityReferrer) refConstraint).getAttributeReferences(new VoidProgressMonitor());
for (DBSEntityAttributeRef constraintColumn : CommonUtils.safeCollection(columns)) {
if (!firstColumn) decl.append(","); //$NON-NLS-1$
firstColumn = false;
......
......@@ -66,7 +66,7 @@ public abstract class SQLIndexManager<OBJECT_TYPE extends JDBCTableIndex<? exten
try {
// Get columns using void monitor
boolean firstColumn = true;
for (DBSTableIndexColumn indexColumn : CommonUtils.safeCollection(command.getObject().getAttributeReferences(VoidProgressMonitor.INSTANCE))) {
for (DBSTableIndexColumn indexColumn : CommonUtils.safeCollection(command.getObject().getAttributeReferences(new VoidProgressMonitor()))) {
if (!firstColumn) decl.append(","); //$NON-NLS-1$
firstColumn = false;
decl.append(indexColumn.getName());
......
......@@ -267,7 +267,7 @@ public abstract class DBNDatabaseNode extends DBNNode implements DBSWrapper, DBP
*/
public void updateChildrenOrder(boolean reflect) {
try {
refreshNodeContent(VoidProgressMonitor.INSTANCE, getObject(), this, reflect);
refreshNodeContent(new VoidProgressMonitor(), getObject(), this, reflect);
} catch (DBException e) {
log.error("Error reordering node children", e);
}
......
......@@ -60,7 +60,7 @@ public class DBNProject extends DBNResource
public DBNProjectDatabases getDatabases()
{
try {
for (DBNNode db : getChildren(VoidProgressMonitor.INSTANCE)) {
for (DBNNode db : getChildren(new VoidProgressMonitor())) {
if (db instanceof DBNProjectDatabases) {
return (DBNProjectDatabases) db;
}
......@@ -152,7 +152,7 @@ public class DBNProject extends DBNResource
DBNResource resNode = this;
for (IResource res : path) {
try {
resNode.getChildren(VoidProgressMonitor.INSTANCE);
resNode.getChildren(new VoidProgressMonitor());
} catch (DBException e) {
log.error(e);
}
......
......@@ -24,11 +24,9 @@ import org.eclipse.core.runtime.NullProgressMonitor;
*/
public class VoidProgressMonitor implements DBRProgressMonitor {
public static final VoidProgressMonitor INSTANCE = new VoidProgressMonitor();
private final IProgressMonitor NESTED_INSTANCE = new NullProgressMonitor();
private static final IProgressMonitor NESTED_INSTANCE = new NullProgressMonitor();
protected VoidProgressMonitor() {
public VoidProgressMonitor() {
}
@Override
......
......@@ -534,7 +534,7 @@ public final class SQLUtils {
public static String convertStreamToSQL(DBSAttributeBase attribute, DBDContent content, DBDValueHandler valueHandler, SQLDataSource dataSource) {
try {
DBRProgressMonitor monitor = VoidProgressMonitor.INSTANCE;
DBRProgressMonitor monitor = new VoidProgressMonitor();
if (valueHandler instanceof DBDContentValueHandler) {
StringWriter buffer = new StringWriter();
((DBDContentValueHandler) valueHandler).writeStreamValue(monitor, dataSource, attribute, content, buffer);
......
......@@ -47,7 +47,7 @@ public class DBVEntityConstraintColumn implements DBSEntityAttributeRef {
// Here we use void monitor.
// In real life entity columns SHOULD be already read so it doesn't matter
// But I'm afraid that in some very special cases it does. Thant's too bad.
return constraint.getEntity().getAttribute(VoidProgressMonitor.INSTANCE, attributeName);
return constraint.getEntity().getAttribute(new VoidProgressMonitor(), attributeName);
}
public String getAttributeName()
......
......@@ -45,7 +45,7 @@ public class HandlerConnectionValidate extends AbstractHandler {
private void validateNode(Shell activeShell, DBPDataSource dataSource) {
try {
final DBCSession session = DBUtils.openUtilSession(VoidProgressMonitor.INSTANCE, dataSource, "test");
final DBCSession session = DBUtils.openUtilSession(new VoidProgressMonitor(), dataSource, "test");
final DBCStatement dbStat = session.prepareStatement(DBCStatementType.EXEC, "SELECT x.attributes FROM \"public\".entry x LIMIT 200", true, false, false);
if (dbStat.executeStatement()) {
final DBCResultSet dbResult = dbStat.openResultSet();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册