提交 530fc3ef 编写于 作者: S serge-rider

Merge remote-tracking branch 'origin/devel' into devel

......@@ -64,6 +64,7 @@ import org.jkiss.dbeaver.ui.dialogs.connection.PasswordChangeDialog;
import org.jkiss.dbeaver.ui.dialogs.driver.DriverDownloadDialog;
import org.jkiss.dbeaver.ui.dialogs.driver.DriverEditDialog;
import org.jkiss.dbeaver.ui.dialogs.exec.ExecutionQueueErrorJob;
import org.jkiss.dbeaver.ui.internal.UIConnectionMessages;
import org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerObjectOpen;
import org.jkiss.dbeaver.ui.navigator.dialogs.ObjectBrowserDialog;
import org.jkiss.dbeaver.ui.views.process.ProcessPropertyTester;
......@@ -283,13 +284,24 @@ public class DBeaverUI implements DBPPlatformUI {
@Override
public DBPAuthInfo promptUserCredentials(final String prompt, final String userName, final String userPassword, final boolean passwordOnly, boolean showSavePassword) {
return promptUserCredentials(prompt,
UIConnectionMessages.dialog_connection_auth_label_username,
userName,
UIConnectionMessages.dialog_connection_auth_label_password,
userPassword,
passwordOnly,
showSavePassword);
}
// Ask user
@Override
public DBPAuthInfo promptUserCredentials(String prompt, String userNameLabel, String userName, String passwordLabel, String userPassword, boolean passwordOnly, boolean showSavePassword) {
return new UITask<DBPAuthInfo>() {
@Override
public DBPAuthInfo runTask() {
final Shell shell = UIUtils.getActiveWorkbenchShell();
final BaseAuthDialog authDialog = new BaseAuthDialog(shell, prompt, passwordOnly, showSavePassword);
authDialog.setUserNameLabel(userNameLabel);
authDialog.setPasswordLabel(passwordLabel);
if (!passwordOnly) {
authDialog.setUserName(userName);
}
......
......@@ -120,11 +120,16 @@ public class DiagramObjectCollector {
continue;
}
if (entity instanceof DBSEntity) {
if ((entity instanceof DBSTablePartition && !showPartitions) || (DBUtils.isView((DBSEntity) entity) && !showViews)) {
DBSEntity entity1 = (DBSEntity) entity;
if ((entity instanceof DBSTablePartition && !showPartitions) || (DBUtils.isView(entity1) && !showViews)) {
continue;
}
tables.add((DBSEntity) entity);
if (ERDUtils.skipSystemEntity(entity1)) {
continue;
}
tables.add(entity1);
} else if (entity instanceof DBSObjectContainer) {
collectTables(monitor, (DBSObjectContainer) entity, tables, showViews, showPartitions);
}
......
......@@ -159,8 +159,7 @@ public class ERDUtils
final DBSEntity entity1 = (DBSEntity) entity;
boolean showSystemObjects = entity1.getDataSource().getContainer().getNavigatorSettings().isShowSystemObjects();
if (!showSystemObjects && entity1 instanceof DBPSystemObject && ((DBPSystemObject) entity1).isSystem()) {
if (skipSystemEntity(entity1)) {
continue;
}
......@@ -246,4 +245,9 @@ public class ERDUtils
return result;
}
public static boolean skipSystemEntity(DBSEntity entity) {
boolean showSystemObjects = entity.getDataSource().getContainer().getNavigatorSettings().isShowSystemObjects();
return !showSystemObjects && entity instanceof DBPSystemObject && ((DBPSystemObject) entity).isSystem();
}
}
......@@ -57,7 +57,11 @@ public class TeradataMetaModel extends GenericMetaModel implements DBDValueHandl
@Override
public GenericTableBase createTableImpl(GenericStructContainer container, @Nullable String tableName, @Nullable String tableType, @Nullable JDBCResultSet dbResult) {
return new TeradataTable(container, tableName, tableType, dbResult);
if (tableType != null && isView(tableType)) {
return new GenericView(container, tableName, tableType, dbResult);
} else {
return new TeradataTable(container, tableName, tableType, dbResult);
}
}
@Override
......
......@@ -245,12 +245,14 @@ public class JDBCExecutionContext extends AbstractExecutionContext<JDBCDataSourc
}
private void closeContext(boolean removeContext) {
disconnect();
// We remove context before it is actually closed.
// Because disconnect may (potentially) hang in socket forever
if (removeContext) {
// Remove self from context list
this.instance.removeContext(this);
}
disconnect();
}
//////////////////////////////////////////////////////////////
......
......@@ -73,6 +73,8 @@ public interface DBPPlatformUI {
*/
DBPAuthInfo promptUserCredentials(String prompt, String userName, String userPassword, boolean passwordOnly, boolean showSavePassword);
DBPAuthInfo promptUserCredentials(String prompt, String userNameLabel, String userName, String passwordLabel, String userPassword, boolean passwordOnly, boolean showSavePassword);
/**
* Asks for password change. Returns null if user canceled this action.
*/
......
......@@ -111,6 +111,11 @@ public class ConsoleUserInterface implements DBPPlatformUI {
throw new IllegalStateException("Can not prompt user credentials in non-interactive mode");
}
@Override
public DBPAuthInfo promptUserCredentials(String prompt, String userNameLabel, String userName, String passwordLabel, String userPassword, boolean passwordOnly, boolean showSavePassword) {
throw new IllegalStateException("Can not prompt user credentials in non-interactive mode");
}
@Override
public DBAPasswordChangeInfo promptUserPasswordChange(String prompt, String userName, String oldPassword) {
throw new IllegalStateException("Can not prompt user password change in non-interactive mode");
......
......@@ -200,7 +200,7 @@ public class DataSourceRegistry implements DBPDataSourceRegistry {
public DataSourceDescriptor findDataSourceByName(String name) {
synchronized (dataSources) {
for (DataSourceDescriptor dsd : dataSources.values()) {
if (dsd.getName().equals(name)) {
if (!dsd.isHidden() && dsd.getName().equals(name)) {
return dsd;
}
}
......
......@@ -34,6 +34,8 @@ public class BaseAuthDialog extends BaseDialog implements BlockingPopupDialog
{
private static final String DIALOG_ID = "DBeaver.BaseAuthDialog";//$NON-NLS-1$
private String userNameLabel = UIConnectionMessages.dialog_connection_auth_label_username;
private String passwordLabel = UIConnectionMessages.dialog_connection_auth_label_password;
private boolean passwordOnly;
private boolean showSavePassword;
private DBPAuthInfo authInfo = new DBPAuthInfo();
......@@ -56,6 +58,14 @@ public class BaseAuthDialog extends BaseDialog implements BlockingPopupDialog
return UIUtils.getDialogSettings(DIALOG_ID);
}
public void setUserNameLabel(String userNameLabel) {
this.userNameLabel = userNameLabel;
}
public void setPasswordLabel(String passwordLabel) {
this.passwordLabel = passwordLabel;
}
public DBPAuthInfo getAuthInfo()
{
return authInfo;
......@@ -123,7 +133,7 @@ public class BaseAuthDialog extends BaseDialog implements BlockingPopupDialog
credGroup.setLayoutData(gd);
if (!passwordOnly) {
Label usernameLabel = new Label(credGroup, SWT.NONE);
usernameLabel.setText(UIConnectionMessages.dialog_connection_auth_label_username);
usernameLabel.setText(this.userNameLabel);
usernameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
usernameText = new Text(credGroup, SWT.BORDER);
......@@ -138,7 +148,7 @@ public class BaseAuthDialog extends BaseDialog implements BlockingPopupDialog
}
Label passwordLabel = new Label(credGroup, SWT.NONE);
passwordLabel.setText(UIConnectionMessages.dialog_connection_auth_label_password);
passwordLabel.setText(this.passwordLabel);
passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
passwordText = new Text(credGroup, SWT.BORDER | SWT.PASSWORD);
......
......@@ -69,11 +69,12 @@ public class ProjectSelectorPanel {
}
if (selectedProject == null) {
projectCombo.select(0);
selectedProject = projects.get(0);
} else {
projectCombo.setText(selectedProject.getName());
selectedProject = DBWorkbench.getPlatform().getWorkspace().getActiveProject();
if (!projects.contains(selectedProject)) {
selectedProject = projects.get(0);
}
}
projectCombo.setText(selectedProject.getName());
projectCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
......
......@@ -57,6 +57,7 @@ import org.jkiss.dbeaver.ui.dnd.TreeNodeTransfer;
import org.jkiss.dbeaver.ui.editors.MultiPageDatabaseEditor;
import org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerObjectOpen;
import org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerRefresh;
import org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorContent;
import org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView;
import org.jkiss.dbeaver.ui.navigator.database.NavigatorViewBase;
import org.jkiss.dbeaver.ui.navigator.project.ProjectNavigatorView;
......@@ -493,7 +494,14 @@ public class NavigatorUtils {
} else if (curObject == null) {
for (DBNNode node : TreeNodeTransfer.getInstance().getObject()) {
if (node instanceof DBNDataSource) {
((DBNDataSource) node).moveToFolder(node.getOwnerProject(), null);
// Drop datasource on a view
// We need target project
if (viewer.getInput() instanceof DatabaseNavigatorContent) {
DBNNode rootNode = ((DatabaseNavigatorContent) viewer.getInput()).getRootNode();
if (rootNode != null && rootNode.getOwnerProject() != null) {
((DBNDataSource) node).moveToFolder(rootNode.getOwnerProject(), null);
}
}
} else if (node instanceof DBNLocalFolder) {
((DBNLocalFolder) node).getFolder().setParent(null);
} else {
......
......@@ -55,14 +55,18 @@ public class NavigatorHandlerObjectDelete extends NavigatorHandlerObjectBase imp
return null;
}
final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
tryDeleteObjects(window, (IStructuredSelection) selection);
return null;
}
public static boolean tryDeleteObjects(IWorkbenchWindow window, IStructuredSelection selection) {
@SuppressWarnings("unchecked")
final List<Object> selectedObjects = ((IStructuredSelection) selection).toList();
final List<Object> selectedObjects = selection.toList();
final NavigatorObjectsDeleter deleter = NavigatorObjectsDeleter.of(selectedObjects, window);
makeDeletionAttempt(window, selectedObjects, deleter);
return null;
return makeDeletionAttempt(window, selectedObjects, deleter);
}
private void makeDeletionAttempt(final IWorkbenchWindow window, final List<Object> selectedObjects, final NavigatorObjectsDeleter deleter) {
private static boolean makeDeletionAttempt(final IWorkbenchWindow window, final List<Object> selectedObjects, final NavigatorObjectsDeleter deleter) {
if (deleter.hasNodesFromDifferentDataSources()) {
// attempt to delete database nodes from different databases
DBWorkbench.getPlatformUI().
......@@ -70,7 +74,7 @@ public class NavigatorHandlerObjectDelete extends NavigatorHandlerObjectBase imp
UINavigatorMessages.error_deleting_multiple_objects_from_different_datasources_title,
UINavigatorMessages.error_deleting_multiple_objects_from_different_datasources_message
);
return;
return false;
}
final ConfirmationDialog dialog = ConfirmationDialog.of(
window.getShell(),
......@@ -79,13 +83,17 @@ public class NavigatorHandlerObjectDelete extends NavigatorHandlerObjectBase imp
final int result = dialog.open();
if (result == IDialogConstants.YES_ID) {
deleter.delete();
return true;
} else if (result == IDialogConstants.DETAILS_ID) {
final boolean persistCheck = deleter.showScriptWindow();
if (persistCheck) {
deleter.delete();
return true;
} else {
makeDeletionAttempt(window, selectedObjects, deleter);
return makeDeletionAttempt(window, selectedObjects, deleter);
}
} else {
return false;
}
}
......
......@@ -22,7 +22,7 @@ import org.jkiss.dbeaver.model.navigator.DBNNode;
/**
* Tree content
*/
class DatabaseNavigatorContent {
public class DatabaseNavigatorContent {
private final DBNNode rootNode;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册