提交 33a430b2 编写于 作者: J jurgen

Value handlers code cleanup.

UI callbacks model.
Utils refactoring.
上级 b163df2d
......@@ -20,6 +20,7 @@ package org.jkiss.dbeaver.core;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
......@@ -30,16 +31,24 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.services.IDisposable;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBeaverPreferences;
import org.jkiss.dbeaver.model.access.DBAAuthInfo;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.runtime.DBRRunnableContext;
import org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress;
import org.jkiss.dbeaver.model.ui.DBUICallback;
import org.jkiss.dbeaver.model.ui.DBUserInterface;
import org.jkiss.dbeaver.runtime.RunnableContextDelegate;
import org.jkiss.dbeaver.runtime.RunnableWithResult;
import org.jkiss.dbeaver.runtime.RuntimeUtils;
import org.jkiss.dbeaver.runtime.VoidProgressMonitor;
import org.jkiss.dbeaver.ui.AbstractUIJob;
import org.jkiss.dbeaver.ui.SharedTextColors;
import org.jkiss.dbeaver.ui.TrayIconHandler;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.dialogs.connection.BaseAuthDialog;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
......@@ -49,7 +58,7 @@ import java.util.List;
/**
* DBeaver UI core
*/
public class DBeaverUI {
public class DBeaverUI implements DBUICallback {
static final Log log = Log.getLog(DBeaverUI.class);
......@@ -104,8 +113,8 @@ public class DBeaverUI {
private void initialize()
{
this.sharedTextColors = new SharedTextColors();
this.trayItem = new TrayIconHandler();
DBUserInterface.setInstance(this);
}
public static AbstractUIJob runUIJob(String jobName, final DBRRunnableWithProgress runnableWithProgress)
......@@ -272,4 +281,31 @@ public class DBeaverUI {
public void addDisposeListener(IDisposable disposable) {
globalDisposables.add(disposable);
}
@Override
public void showError(@NotNull String title, @Nullable String message, @NotNull IStatus status) {
UIUtils.showErrorDialog(null, title, message, status);
}
@Override
public DBAAuthInfo promptUserCredentials(String prompt, String userName, String userPassword) {
// Ask user
final Shell shell = DBeaverUI.getActiveWorkbenchShell();
final BaseAuthDialog authDialog = new BaseAuthDialog(shell, prompt);
authDialog.setUserName(userName);
authDialog.setUserPassword(userPassword);
final RunnableWithResult<Boolean> binder = new RunnableWithResult<Boolean>() {
@Override
public void run()
{
result = (authDialog.open() == IDialogConstants.OK_ID);
}
};
UIUtils.runInUI(shell, binder);
if (binder.getResult() != null && binder.getResult()) {
return authDialog.getAuthInfo();
} else {
return null;
}
}
}
......@@ -22,7 +22,6 @@ import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.DBeaverPreferences;
import org.jkiss.dbeaver.core.CoreMessages;
import org.jkiss.dbeaver.core.Log;
import org.jkiss.dbeaver.model.data.*;
import org.jkiss.dbeaver.model.edit.DBEPersistAction;
......@@ -35,9 +34,7 @@ import org.jkiss.dbeaver.model.struct.rdb.*;
import org.jkiss.dbeaver.registry.DataSourceProviderRegistry;
import org.jkiss.dbeaver.registry.DataTypeProviderDescriptor;
import org.jkiss.dbeaver.runtime.RuntimeUtils;
import org.jkiss.dbeaver.runtime.VoidProgressMonitor;
import org.jkiss.dbeaver.runtime.sql.SQLConstants;
import org.jkiss.dbeaver.ui.data.IValueController;
import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.utils.ArrayUtils;
import org.jkiss.utils.CommonUtils;
......@@ -442,30 +439,6 @@ public final class DBUtils {
return valueHandler.getValueFromObject(session, type, null, false);
}
@Nullable
public static Object makeNullValue(@NotNull final IValueController valueController)
{
try {
DBCExecutionContext executionContext = valueController.getExecutionContext();
if (executionContext == null) {
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
DBCSession session = executionContext.openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Set NULL value");
try {
return DBUtils.makeNullValue(
session,
valueController.getValueHandler(),
valueController.getValueType());
} finally {
session.close();
}
} catch (DBCException e) {
log.error("Can't make NULL value", e);
return null;
}
}
@NotNull
public static DBDAttributeBindingMeta getAttributeBinding(DBCSession session, DBCAttributeMetaData attributeMeta)
{
......
......@@ -15,22 +15,46 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ui.data.editors;
package org.jkiss.dbeaver.model.access;
import org.jkiss.dbeaver.model.data.DBDDataFormatter;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
/**
* Auth info
*/
public class DBAAuthInfo {
private String userName;
private String userPassword;
private boolean savePassword;
import java.util.Locale;
public DBAAuthInfo() {
}
/**
* NumberEditorHelper
*/
public interface NumberEditorHelper {
public DBAAuthInfo(String userName, String userPassword, boolean savePassword) {
this.userName = userName;
this.userPassword = userPassword;
this.savePassword = savePassword;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
Locale getLocale();
public String getUserPassword() {
return userPassword;
}
DBDDataFormatter getFormatter();
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
Class<? extends Number> getNumberType(DBSTypedObject type, Object originalValue);
public boolean isSavePassword() {
return savePassword;
}
public void setSavePassword(boolean savePassword) {
this.savePassword = savePassword;
}
}
......@@ -20,12 +20,13 @@ package org.jkiss.dbeaver.model.impl.data;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.core.Log;
import org.jkiss.dbeaver.model.data.*;
import org.jkiss.dbeaver.model.data.DBDDataFormatter;
import org.jkiss.dbeaver.model.data.DBDDataFormatterProfile;
import org.jkiss.dbeaver.model.data.DBDDisplayFormat;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.impl.data.formatters.DefaultDataFormatter;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import org.jkiss.dbeaver.ui.data.IValueController;
import java.text.ParseException;
import java.util.Date;
......@@ -182,8 +183,4 @@ public abstract class DateTimeValueHandler extends BaseValueHandler {
return formatter;
}
private boolean isTimestamp(IValueController valueController) {
return valueController.getValueType().getTypeID() == java.sql.Types.TIMESTAMP;
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@
package org.jkiss.dbeaver.model.impl.data.formatters;
import org.jkiss.dbeaver.model.data.DBDBinaryFormatter;
import org.jkiss.dbeaver.utils.TextUtils;
import org.jkiss.dbeaver.utils.GeneralUtils;
/**
* Hex formatter
......@@ -42,7 +42,7 @@ public class BinaryFormatterHex implements DBDBinaryFormatter {
{
char[] chars = new char[length * 2];
for (int i = offset; i < offset + length; i++) {
String hex = TextUtils.byteToHex[bytes[i] & 0x0ff];
String hex = GeneralUtils.byteToHex[bytes[i] & 0x0ff];
chars[i * 2] = hex.charAt(0);
chars[i * 2 + 1] = hex.charAt(1);
}
......
......@@ -20,34 +20,32 @@ package org.jkiss.dbeaver.model.impl.jdbc.data.handlers;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.data.*;
import org.jkiss.dbeaver.model.data.DBDDataFormatter;
import org.jkiss.dbeaver.model.data.DBDDataFormatterProfile;
import org.jkiss.dbeaver.model.data.DBDDisplayFormat;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.data.formatters.DefaultDataFormatter;
import org.jkiss.dbeaver.ui.data.editors.NumberEditorHelper;
import org.jkiss.dbeaver.ui.data.editors.NumberInlineEditor;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import org.jkiss.dbeaver.utils.GeneralUtils;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.SQLException;
import java.util.Locale;
/**
* JDBC number value handler
*/
public class JDBCNumberValueHandler extends JDBCAbstractValueHandler implements NumberEditorHelper {
public class JDBCNumberValueHandler extends JDBCAbstractValueHandler {
private Locale locale;
private DBDDataFormatter formatter;
public JDBCNumberValueHandler(DBDDataFormatterProfile formatterProfile)
{
try {
locale = formatterProfile.getLocale();
formatter = formatterProfile.createFormatter(DBDDataFormatter.TYPE_NAME_NUMBER);
} catch (Exception e) {
log.error("Can't create formatter for number value handler", e); //$NON-NLS-1$
......@@ -230,56 +228,13 @@ public class JDBCNumberValueHandler extends JDBCAbstractValueHandler implements
} else if (object instanceof Number) {
return object;
} else if (object instanceof String) {
return NumberInlineEditor.convertStringToNumber((String)object, getNumberType(type, null), formatter);
return GeneralUtils.convertStringToNumber((String) object, getNumberType(type), formatter);
} else {
log.warn("Unrecognized type '" + object.getClass().getName() + "' - can't convert to numeric");
return null;
}
}
@Override
public Locale getLocale() {
return locale;
}
@Override
public DBDDataFormatter getFormatter() {
return formatter;
}
@Override
public Class<? extends Number> getNumberType(DBSTypedObject type, Object originalValue) {
if (originalValue instanceof Number) {
return ((Number)originalValue).getClass();
} else {
switch (type.getTypeID()) {
case java.sql.Types.BIGINT:
return Long.class;
case java.sql.Types.DECIMAL:
case java.sql.Types.DOUBLE:
case java.sql.Types.REAL:
return Double.class;
case java.sql.Types.FLOAT:
return Float.class;
case java.sql.Types.INTEGER:
return Integer.class;
case java.sql.Types.SMALLINT:
case java.sql.Types.TINYINT:
return Short.class;
case java.sql.Types.BIT:
return Byte.class;
case java.sql.Types.NUMERIC:
return BigDecimal.class;
default:
if (type.getScale() > 0) {
return Double.class;
} else {
return Long.class;
}
}
}
}
public Class<? extends Number> getNumberType(DBSTypedObject type) {
switch (type.getTypeID()) {
case java.sql.Types.BIGINT:
......
......@@ -17,24 +17,18 @@
*/
package org.jkiss.dbeaver.model.impl.net;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.widgets.Shell;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBeaverPreferences;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.core.DBeaverUI;
import org.jkiss.dbeaver.model.DBIcon;
import org.jkiss.dbeaver.model.DBPPreferenceStore;
import org.jkiss.dbeaver.model.access.DBAAuthInfo;
import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
import org.jkiss.dbeaver.model.net.DBWHandlerConfiguration;
import org.jkiss.dbeaver.model.net.DBWHandlerType;
import org.jkiss.dbeaver.model.struct.DBSDataSourceContainer;
import org.jkiss.dbeaver.model.ui.DBUserInterface;
import org.jkiss.dbeaver.registry.encode.EncryptionException;
import org.jkiss.dbeaver.registry.encode.SecuredPasswordEncrypter;
import org.jkiss.dbeaver.runtime.RunnableWithResult;
import org.jkiss.dbeaver.ui.DBeaverIcons;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.dialogs.connection.BaseAuthDialog;
import org.jkiss.utils.CommonUtils;
import java.net.Authenticator;
......@@ -61,11 +55,11 @@ public class GlobalProxyAuthenticator extends Authenticator {
String userName = store.getString(DBeaverPreferences.UI_PROXY_USER);
String userPassword = decryptPassword(store.getString(DBeaverPreferences.UI_PROXY_PASSWORD));
if (CommonUtils.isEmpty(userName) || CommonUtils.isEmpty(userPassword)) {
BaseAuthDialog.AuthInfo authInfo = readCredentialsInUI("Auth proxy '" + proxyHost + "'", userName, userPassword);
DBAAuthInfo authInfo = readCredentialsInUI("Auth proxy '" + proxyHost + "'", userName, userPassword);
if (authInfo != null) {
userName = authInfo.userName;
userPassword = authInfo.userPassword;
if (authInfo.savePassword) {
userName = authInfo.getUserName();
userPassword = authInfo.getUserPassword();
if (authInfo.isSavePassword()) {
// Save in preferences
store.setValue(DBeaverPreferences.UI_PROXY_USER, userName);
store.setValue(DBeaverPreferences.UI_PROXY_PASSWORD, encryptPassword(userPassword));
......@@ -90,11 +84,11 @@ public class GlobalProxyAuthenticator extends Authenticator {
String userName = networkHandler.getUserName();
String userPassword = networkHandler.getPassword();
if (CommonUtils.isEmpty(userName) || CommonUtils.isEmpty(userPassword)) {
BaseAuthDialog.AuthInfo authInfo = readCredentialsInUI(getRequestingPrompt(), userName, userPassword);
DBAAuthInfo authInfo = readCredentialsInUI(getRequestingPrompt(), userName, userPassword);
if (authInfo != null) {
userName = authInfo.userName;
userPassword = authInfo.userPassword;
if (authInfo.savePassword) {
userName = authInfo.getUserName();
userPassword = authInfo.getUserPassword();
if (authInfo.isSavePassword()) {
// Save DS config
networkHandler.setUserName(userName);
networkHandler.setPassword(userPassword);
......@@ -140,26 +134,9 @@ public class GlobalProxyAuthenticator extends Authenticator {
}
}
private BaseAuthDialog.AuthInfo readCredentialsInUI(String prompt, String userName, String userPassword)
private DBAAuthInfo readCredentialsInUI(String prompt, String userName, String userPassword)
{
// Ask user
final Shell shell = DBeaverUI.getActiveWorkbenchShell();
final BaseAuthDialog authDialog = new BaseAuthDialog(shell, prompt, DBeaverIcons.getImage(DBIcon.CONNECTIONS));
authDialog.setUserName(userName);
authDialog.setUserPassword(userPassword);
final RunnableWithResult<Boolean> binder = new RunnableWithResult<Boolean>() {
@Override
public void run()
{
result = (authDialog.open() == IDialogConstants.OK_ID);
}
};
UIUtils.runInUI(shell, binder);
if (binder.getResult() != null && binder.getResult()) {
return authDialog.getAuthInfo();
} else {
return null;
}
return DBUserInterface.getInstance().promptUserCredentials(prompt, userName, userPassword);
}
}
......@@ -19,7 +19,6 @@ package org.jkiss.dbeaver.model.net;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ui.IObjectPropertyConfiguration;
import org.jkiss.dbeaver.model.DBPDriver;
import org.jkiss.dbeaver.registry.NetworkHandlerDescriptor;
......@@ -29,7 +28,7 @@ import java.util.Map;
/**
* Network handler configuration
*/
public class DBWHandlerConfiguration implements IObjectPropertyConfiguration {
public class DBWHandlerConfiguration {
private final NetworkHandlerDescriptor descriptor;
private final DBPDriver driver;
......@@ -131,7 +130,6 @@ public class DBWHandlerConfiguration implements IObjectPropertyConfiguration {
this.savePassword = savePassword;
}
@Override
public Map<String, String> getProperties()
{
return properties;
......
......@@ -20,11 +20,11 @@ package org.jkiss.dbeaver.model.sql;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ui.ICommentsSupport;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPIdentifierCase;
import org.jkiss.dbeaver.model.DBPKeywordType;
import org.jkiss.dbeaver.model.data.DBDDataFilter;
import org.jkiss.utils.Pair;
import java.util.Collection;
import java.util.List;
......@@ -33,7 +33,7 @@ import java.util.Set;
/**
* SQL dialect
*/
public interface SQLDialect extends ICommentsSupport {
public interface SQLDialect {
int USAGE_NONE = 0;
int USAGE_DML = 1;
......@@ -200,4 +200,17 @@ public interface SQLDialect extends ICommentsSupport {
String addFiltersToQuery(DBPDataSource dataSource, String query, DBDDataFilter filter) throws DBException;
/**
* Two-item array containing begin and end of multi-line comments.
* @return string array or null if multi-line comments are not supported
*/
@Nullable
Pair<String, String> getMultiLineComments();
/**
* List of possible single-line comment prefixes
* @return comment prefixes or null if single line comments are nto supported
*/
String[] getSingleLineComments();
}
......@@ -15,16 +15,21 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ui;
import java.util.Map;
package org.jkiss.dbeaver.model.ui;
import org.eclipse.core.runtime.IStatus;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.access.DBAAuthInfo;
/**
* IDataSourceConnectionEditor
* User interface interactions
*/
public interface IObjectPropertyConfiguration
{
public interface DBUICallback {
void showError(@NotNull final String title, @Nullable final String message, @NotNull final IStatus status);
DBAAuthInfo promptUserCredentials(String prompt, String userName, String userPassword);
Map<String, String> getProperties();
}
}
\ No newline at end of file
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.model.ui;
import org.eclipse.core.runtime.IStatus;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.access.DBAAuthInfo;
/**
* User interface interactions
*/
public class DBUserInterface {
private static DBUICallback instance = new DBUICallback() {
@Override
public void showError(@NotNull String title, @Nullable String message, @NotNull IStatus status) {
System.out.println(title + (message == null ? "" : ": " + message));
printStatus(status, 0);
}
private void printStatus(@NotNull IStatus status, int level) {
char[] indent = new char[level * 4];
for (int i = 0; i < indent.length; i++) indent[i] = ' ';
if (status.getMessage() != null) {
System.out.println("" + indent + status.getMessage());
}
if (status.getException() != null) {
status.getException().printStackTrace(System.out);
}
}
@Override
public DBAAuthInfo promptUserCredentials(String prompt, String userName, String userPassword) {
return null;
}
};
public static DBUICallback getInstance() {
return instance;
}
public static void setInstance(DBUICallback instance) {
DBUserInterface.instance = instance;
}
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ import org.eclipse.swt.widgets.Composite;
/**
* IDataSourceConnectionEditor
*/
public interface IObjectPropertyConfigurator<T extends IObjectPropertyConfiguration>
public interface IObjectPropertyConfigurator<T>
{
void createControl(Composite parent);
......
......@@ -765,21 +765,7 @@ public class UIUtils {
showErrorDialog(shell, title, message, (Throwable) null);
}
public static void showErrorDialog(@Nullable Shell shell, @NotNull String title, @Nullable String message,
@NotNull Collection<String> errorMessages)
{
// log.debug(message);
java.util.List<Status> messageStatuses = new ArrayList<Status>(errorMessages.size());
for (String error : errorMessages) {
messageStatuses.add(new Status(Status.ERROR, DBeaverCore.getCorePluginID(), error));
}
MultiStatus status = new MultiStatus(DBeaverCore.getCorePluginID(), 0, messageStatuses.toArray(new IStatus[messageStatuses
.size()]), message, null);
showErrorDialog(shell, title, message, status);
}
public static void showErrorDialog(@Nullable final Shell shell, @NotNull final String title, @Nullable final String message,
@NotNull final IStatus status)
public static void showErrorDialog(@Nullable final Shell shell, @NotNull final String title, @Nullable final String message, @NotNull final IStatus status)
{
for (IStatus s = status; s != null; ) {
if (s.getException() instanceof DBException) {
......
......@@ -73,6 +73,7 @@ import org.jkiss.dbeaver.ui.controls.CImageCombo;
import org.jkiss.dbeaver.ui.controls.resultset.view.EmptyPresentation;
import org.jkiss.dbeaver.ui.controls.resultset.view.StatisticsPresentation;
import org.jkiss.dbeaver.ui.data.IValueController;
import org.jkiss.dbeaver.ui.data.managers.BaseValueManager;
import org.jkiss.dbeaver.ui.dialogs.ActiveWizardDialog;
import org.jkiss.dbeaver.ui.dialogs.ConfirmationDialog;
import org.jkiss.dbeaver.ui.dialogs.EditTextDialog;
......@@ -1196,7 +1197,7 @@ public class ResultSetViewer extends Viewer
public void run()
{
valueController.updateValue(
DBUtils.makeNullValue(valueController));
BaseValueManager.makeNullValue(valueController));
}
});
}
......
......@@ -92,6 +92,7 @@ import org.jkiss.dbeaver.ui.controls.resultset.*;
import org.jkiss.dbeaver.ui.data.IValueController;
import org.jkiss.dbeaver.ui.data.IValueEditor;
import org.jkiss.dbeaver.ui.data.IValueEditorStandalone;
import org.jkiss.dbeaver.ui.data.managers.BaseValueManager;
import org.jkiss.dbeaver.ui.dialogs.ConfirmationDialog;
import org.jkiss.dbeaver.runtime.properties.PropertyCollector;
import org.jkiss.dbeaver.ui.properties.PropertySourceDelegate;
......@@ -448,7 +449,7 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
IValueController valueController = new SpreadsheetValueController(
controller, column, row, IValueController.EditType.NONE, null);
if (!valueController.isReadOnly()) {
valueController.updateValue(DBUtils.makeNullValue(valueController));
valueController.updateValue(BaseValueManager.makeNullValue(valueController));
}
}
......
......@@ -28,11 +28,10 @@ import org.jkiss.dbeaver.model.data.DBDDataFormatterProfile;
import org.jkiss.dbeaver.model.data.DBDDisplayFormat;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.data.IValueController;
import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.utils.CommonUtils;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.ParseException;
import java.util.Locale;
/**
......@@ -42,7 +41,6 @@ public class NumberInlineEditor extends BaseValueEditor<Text> {
static final Log log = Log.getLog(NumberInlineEditor.class);
private static final int MAX_NUMBER_LENGTH = 100;
private static final String BAD_DOUBLE_VALUE = "2.2250738585072012e-308"; //$NON-NLS-1$
private DBDDataFormatterProfile formatterProfile;
......@@ -96,58 +94,11 @@ public class NumberInlineEditor extends BaseValueEditor<Text> {
curValue.getClass() :
valueController.getValueHandler().getValueObjectType(valueController.getValueType());
try {
return convertStringToNumber(text, hintType, formatterProfile.createFormatter(DBDDataFormatter.TYPE_NAME_NUMBER));
return GeneralUtils.convertStringToNumber(text, hintType, formatterProfile.createFormatter(DBDDataFormatter.TYPE_NAME_NUMBER));
} catch (Exception e) {
log.error(e);
return null;
}
}
@Nullable
public static Number convertStringToNumber(String text, Class<? extends Number> hintType, DBDDataFormatter formatter)
{
if (text == null || text.length() == 0) {
return null;
}
try {
if (hintType == Long.class) {
try {
return Long.valueOf(text);
} catch (NumberFormatException e) {
return new BigInteger(text);
}
} else if (hintType == Integer.class) {
return Integer.valueOf(text);
} else if (hintType == Short.class) {
return Short.valueOf(text);
} else if (hintType == Byte.class) {
return Byte.valueOf(text);
} else if (hintType == Float.class) {
return Float.valueOf(text);
} else if (hintType == Double.class) {
return toDouble(text);
} else if (hintType == BigInteger.class) {
return new BigInteger(text);
} else {
return new BigDecimal(text);
}
} catch (NumberFormatException e) {
log.debug("Bad numeric value '" + text + "' - " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
try {
return (Number)formatter.parseValue(text, hintType);
} catch (ParseException e1) {
log.debug("Can't parse numeric value [" + text + "] using formatter", e);
return null;
}
}
}
private static Number toDouble(String text)
{
if (text.equals(BAD_DOUBLE_VALUE)) {
return Double.MIN_VALUE;
}
return Double.valueOf(text);
}
}
......@@ -19,8 +19,16 @@ package org.jkiss.dbeaver.ui.data.managers;
import org.eclipse.jface.action.IContributionManager;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.core.CoreMessages;
import org.jkiss.dbeaver.core.Log;
import org.jkiss.dbeaver.model.DBPPropertyManager;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
import org.jkiss.dbeaver.model.exec.DBCExecutionPurpose;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.runtime.VoidProgressMonitor;
import org.jkiss.dbeaver.ui.data.IValueController;
import org.jkiss.dbeaver.ui.data.IValueManager;
......@@ -29,7 +37,31 @@ import org.jkiss.dbeaver.ui.data.IValueManager;
*/
public abstract class BaseValueManager implements IValueManager {
public static final String PROP_CATEGORY_COMPLEX = "Complex";
static final Log log = Log.getLog(BaseValueManager.class);
@Nullable
public static Object makeNullValue(@NotNull final IValueController valueController)
{
try {
DBCExecutionContext executionContext = valueController.getExecutionContext();
if (executionContext == null) {
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
DBCSession session = executionContext.openSession(VoidProgressMonitor.INSTANCE, DBCExecutionPurpose.UTIL, "Set NULL value");
try {
return DBUtils.makeNullValue(
session,
valueController.getValueHandler(),
valueController.getValueType());
} finally {
session.close();
}
} catch (DBCException e) {
log.error("Can't make NULL value", e);
return null;
}
}
@Override
public void contributeActions(@NotNull IContributionManager manager, @NotNull IValueController controller) throws DBCException {
......
......@@ -17,13 +17,15 @@
*/
package org.jkiss.dbeaver.ui.dialogs.connection;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.jkiss.dbeaver.core.CoreMessages;
import org.jkiss.dbeaver.model.DBIcon;
import org.jkiss.dbeaver.model.access.DBAAuthInfo;
import org.jkiss.dbeaver.ui.DBeaverIcons;
import org.jkiss.dbeaver.ui.dialogs.BaseDialog;
import org.jkiss.utils.CommonUtils;
......@@ -33,50 +35,44 @@ import org.jkiss.utils.CommonUtils;
public class BaseAuthDialog extends BaseDialog
{
public static class AuthInfo {
public String userName;
public String userPassword;
public boolean savePassword;
}
private AuthInfo authInfo = new AuthInfo();
private DBAAuthInfo authInfo = new DBAAuthInfo();
private Text usernameText;
private Text passwordText;
private Button savePasswordCheck;
public BaseAuthDialog(Shell parentShell, String title, Image icon)
public BaseAuthDialog(Shell parentShell, String title)
{
super(parentShell, title, icon);
super(parentShell, title, DBeaverIcons.getImage(DBIcon.CONNECTIONS));
}
public AuthInfo getAuthInfo()
public DBAAuthInfo getAuthInfo()
{
return authInfo;
}
public String getUserName() {
return authInfo.userName;
return authInfo.getUserName();
}
public void setUserName(String userName) {
this.authInfo.userName = userName;
this.authInfo.setUserName(userName);
}
public String getUserPassword() {
return authInfo.userPassword;
return authInfo.getUserPassword();
}
public void setUserPassword(String userPassword) {
this.authInfo.userPassword = userPassword;
this.authInfo.setUserPassword(userPassword);
}
public boolean isSavePassword() {
return authInfo.savePassword;
return authInfo.isSavePassword();
}
public void setSavePassword(boolean savePassword) {
this.authInfo.savePassword = savePassword;
this.authInfo.setSavePassword(savePassword);
}
@Override
......@@ -110,8 +106,8 @@ public class BaseAuthDialog extends BaseDialog
gd.widthHint = 120;
//gd.horizontalSpan = 3;
usernameText.setLayoutData(gd);
if (authInfo.userName != null) {
usernameText.setText(authInfo.userName);
if (authInfo.getUserName() != null) {
usernameText.setText(authInfo.getUserName());
}
Label passwordLabel = new Label(credGroup, SWT.NONE);
......@@ -122,8 +118,8 @@ public class BaseAuthDialog extends BaseDialog
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
passwordText.setLayoutData(gd);
if (authInfo.userPassword != null) {
passwordText.setText(authInfo.userPassword);
if (authInfo.getUserPassword() != null) {
passwordText.setText(authInfo.getUserPassword());
}
}
......@@ -131,7 +127,7 @@ public class BaseAuthDialog extends BaseDialog
savePasswordCheck.setText(CoreMessages.dialog_connection_auth_checkbox_save_password);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
savePasswordCheck.setLayoutData(gd);
savePasswordCheck.setSelection(authInfo.savePassword);
savePasswordCheck.setSelection(authInfo.isSavePassword());
if (!CommonUtils.isEmpty(usernameText.getText())) {
passwordText.setFocus();
......@@ -142,9 +138,9 @@ public class BaseAuthDialog extends BaseDialog
@Override
protected void okPressed() {
authInfo.userName = usernameText.getText();
authInfo.userPassword = passwordText.getText();
authInfo.savePassword = savePasswordCheck.getSelection();
authInfo.setUserName(usernameText.getText());
authInfo.setUserPassword(passwordText.getText());
authInfo.setSavePassword(savePasswordCheck.getSelection());
super.okPressed();
}
......
......@@ -40,8 +40,8 @@ public class ConnectionAuthDialog extends BaseAuthDialog
super(parentShell,
networkHandler != null ?
NLS.bind(CoreMessages.dialog_connection_auth_title_for_handler, networkHandler.getTitle()) :
"'" + dataSource.getName() + CoreMessages.dialog_connection_auth_title, //$NON-NLS-1$
DBeaverIcons.getImage(dataSource.getDriver().getIcon()));
"'" + dataSource.getName() + CoreMessages.dialog_connection_auth_title //$NON-NLS-1$
);
this.dataSource = dataSource;
this.networkHandler = networkHandler;
......
......@@ -63,6 +63,7 @@ import org.jkiss.dbeaver.ui.controls.ColumnInfoPanel;
import org.jkiss.dbeaver.ui.data.*;
import org.jkiss.dbeaver.ui.data.IAttributeController;
import org.jkiss.dbeaver.ui.data.IValueController;
import org.jkiss.dbeaver.ui.data.managers.BaseValueManager;
import org.jkiss.dbeaver.ui.dialogs.struct.EditDictionaryDialog;
import org.jkiss.dbeaver.ui.editors.data.DatabaseDataEditor;
import org.jkiss.utils.CommonUtils;
......@@ -384,7 +385,7 @@ public abstract class ValueViewDialog extends Dialog implements IValueEditorStan
if (buttonId == IDialogConstants.IGNORE_ID) {
if (!valueController.isReadOnly()) {
editedValue = DBUtils.makeNullValue(valueController);
editedValue = BaseValueManager.makeNullValue(valueController);
}
super.okPressed();
} else {
......
......@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.model.edit.prop;
package org.jkiss.dbeaver.ui.editors;
import org.jkiss.dbeaver.core.Log;
import org.eclipse.swt.SWT;
......@@ -23,8 +23,9 @@ import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.*;
import org.jkiss.dbeaver.model.edit.DBECommandReflector;
import org.jkiss.dbeaver.model.edit.prop.DBECommandProperty;
import org.jkiss.dbeaver.model.edit.prop.DBEPropertyHandler;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.ui.editors.AbstractDatabaseObjectEditor;
import org.jkiss.utils.CommonUtils;
import java.util.Calendar;
......
......@@ -28,7 +28,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.dbeaver.utils.TextUtils;
import org.jkiss.utils.CommonUtils;
import java.io.IOException;
......@@ -79,7 +78,7 @@ public class HexEditControl extends Composite {
// Compose header row
StringBuilder rowChars = new StringBuilder();
for (int i = 0; i < maxScreenResolution / minCharSize / 3; ++i)
rowChars.append(TextUtils.byteToHex[i & 0x0ff]).append(' ');
rowChars.append(GeneralUtils.byteToHex[i & 0x0ff]).append(' ');
headerRow = rowChars.toString().toUpperCase();
}
......@@ -842,10 +841,10 @@ public class HexEditControl extends Composite {
else
theText.append('0');
} else {
theText.append(TextUtils.nibbleToHex[nibble]);
theText.append(GeneralUtils.nibbleToHex[nibble]);
}
}
theText.append(TextUtils.nibbleToHex[((int) address) & 0x0f]).append(':');
theText.append(GeneralUtils.nibbleToHex[((int) address) & 0x0f]).append(':');
}
return theText;
......@@ -860,7 +859,7 @@ public class HexEditControl extends Composite {
if (isHexOutput) {
result = new StringBuilder(length * 3);
for (int i = 0; i < length; ++i) {
result.append(TextUtils.byteToHex[tmpRawBuffer[i] & 0x0ff]).append(' ');
result.append(GeneralUtils.byteToHex[tmpRawBuffer[i] & 0x0ff]).append(' ');
}
} else {
result = new StringBuilder(length);
......@@ -935,7 +934,7 @@ public class HexEditControl extends Composite {
}
content.get(ByteBuffer.wrap(tmpRawBuffer, 0, 1), null, getCaretPos());
int offset = (int) (getCaretPos() - textAreasStart);
hexText.replaceTextRange(offset * 3, 2, TextUtils.byteToHex[tmpRawBuffer[0] & 0x0ff]);
hexText.replaceTextRange(offset * 3, 2, GeneralUtils.byteToHex[tmpRawBuffer[0] & 0x0ff]);
hexText.setStyleRange(new StyleRange(offset * 3, 2, COLOR_BLUE, null));
previewText.replaceTextRange(
offset,
......
......@@ -28,7 +28,7 @@ import org.jkiss.dbeaver.core.CoreMessages;
import org.jkiss.dbeaver.ui.editors.binary.BinaryTextFinder;
import org.jkiss.dbeaver.ui.editors.binary.HexEditControl;
import org.jkiss.dbeaver.ui.editors.binary.HexManager;
import org.jkiss.dbeaver.utils.TextUtils;
import org.jkiss.dbeaver.utils.GeneralUtils;
import java.io.IOException;
import java.nio.ByteBuffer;
......@@ -352,7 +352,7 @@ public class FindReplaceDialog extends Dialog {
throw new RuntimeException(e);
}
for (int i = 0; i < selectionLength; ++i) {
selectedText.append(TextUtils.byteToHex[selection[i] & 0x0ff]);
selectedText.append(GeneralUtils.byteToHex[selection[i] & 0x0ff]);
}
findGroup.textCombo.setText(selectedText.toString());
findGroup.selectText();
......
......@@ -53,10 +53,7 @@ import org.jkiss.dbeaver.core.Log;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPPreferenceStore;
import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
import org.jkiss.dbeaver.model.sql.SQLDataSource;
import org.jkiss.dbeaver.model.sql.SQLQuery;
import org.jkiss.dbeaver.model.sql.SQLQueryParameter;
import org.jkiss.dbeaver.model.sql.SQLUtils;
import org.jkiss.dbeaver.model.sql.*;
import org.jkiss.dbeaver.runtime.sql.SQLConstants;
import org.jkiss.dbeaver.ui.ICommandIds;
import org.jkiss.dbeaver.ui.ICommentsSupport;
......@@ -69,6 +66,7 @@ import org.jkiss.dbeaver.ui.editors.text.BaseTextEditor;
import org.jkiss.dbeaver.ui.preferences.PreferenceStoreDelegate;
import org.jkiss.dbeaver.utils.TextUtils;
import org.jkiss.utils.CommonUtils;
import org.jkiss.utils.Pair;
import java.util.*;
......@@ -686,7 +684,19 @@ public abstract class SQLEditorBase extends BaseTextEditor {
DBCExecutionContext context = getExecutionContext();
DBPDataSource dataSource = context == null ? null : context.getDataSource();
if (dataSource instanceof SQLDataSource) {
return ((SQLDataSource) dataSource).getSQLDialect();
final SQLDialect dialect = ((SQLDataSource) dataSource).getSQLDialect();
return new ICommentsSupport() {
@Nullable
@Override
public Pair<String, String> getMultiLineComments() {
return dialect.getMultiLineComments();
}
@Override
public String[] getSingleLineComments() {
return dialect.getSingleLineComments();
}
};
} else {
return null;
}
......
......@@ -18,15 +18,22 @@
package org.jkiss.dbeaver.utils;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBeaverPreferences;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.core.Log;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPPreferenceStore;
import org.jkiss.dbeaver.model.data.DBDDataFormatter;
import org.jkiss.dbeaver.ui.data.editors.NumberInlineEditor;
import org.jkiss.utils.CommonUtils;
import java.io.IOException;
import java.io.Writer;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;
......@@ -35,11 +42,14 @@ import java.util.Map;
*/
public class GeneralUtils {
static final Log log = Log.getLog(GeneralUtils.class);
public static final String DEFAULT_FILE_CHARSET_NAME = "UTF-8";
public static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
public static final Charset DEFAULT_FILE_CHARSET = UTF8_CHARSET;
public static final Charset ASCII_CHARSET = Charset.forName("US-ASCII");
public static final String[] byteToHex = new String[256];
public static final char[] nibbleToHex = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
static final Map<String, byte[]> BOM_MAP = new HashMap<String, byte[]>();
static final char[] HEX_CHAR_TABLE = {
'0', '1', '2', '3',
......@@ -47,6 +57,15 @@ public class GeneralUtils {
'8', '9', 'a', 'b',
'c', 'd', 'e', 'f'
};
private static final String BAD_DOUBLE_VALUE = "2.2250738585072012e-308"; //$NON-NLS-1$
static {
// Compose byte to hex map
for (int i = 0; i < 256; ++i) {
byteToHex[i] = Character.toString(nibbleToHex[i >>> 4]) + nibbleToHex[i & 0x0f];
}
}
public static String getDefaultFileEncoding()
{
......@@ -137,4 +156,51 @@ public class GeneralUtils {
}
return bytes;
}
@Nullable
public static Number convertStringToNumber(String text, Class<? extends Number> hintType, DBDDataFormatter formatter)
{
if (text == null || text.length() == 0) {
return null;
}
try {
if (hintType == Long.class) {
try {
return Long.valueOf(text);
} catch (NumberFormatException e) {
return new BigInteger(text);
}
} else if (hintType == Integer.class) {
return Integer.valueOf(text);
} else if (hintType == Short.class) {
return Short.valueOf(text);
} else if (hintType == Byte.class) {
return Byte.valueOf(text);
} else if (hintType == Float.class) {
return Float.valueOf(text);
} else if (hintType == Double.class) {
return toDouble(text);
} else if (hintType == BigInteger.class) {
return new BigInteger(text);
} else {
return new BigDecimal(text);
}
} catch (NumberFormatException e) {
log.debug("Bad numeric value '" + text + "' - " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
try {
return (Number)formatter.parseValue(text, hintType);
} catch (ParseException e1) {
log.debug("Can't parse numeric value [" + text + "] using formatter", e);
return null;
}
}
}
private static Number toDouble(String text)
{
if (text.equals(BAD_DOUBLE_VALUE)) {
return Double.MIN_VALUE;
}
return Double.valueOf(text);
}
}
......@@ -37,18 +37,8 @@ import java.util.regex.Pattern;
public class TextUtils {
public static final char PARAGRAPH_CHAR = (char) 182;
public static final String[] byteToHex = new String[256];
public static final char[] nibbleToHex = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
public static Pattern VAR_PATTERN = Pattern.compile("(\\$\\{([\\w\\.\\-]+)\\})", Pattern.CASE_INSENSITIVE);
static {
// Compose byte to hex map
for (int i = 0; i < 256; ++i) {
TextUtils.byteToHex[i] = Character.toString(TextUtils.nibbleToHex[i >>> 4]) + TextUtils.nibbleToHex[i & 0x0f];
}
}
public static boolean isEmptyLine(IDocument document, int line)
throws BadLocationException {
IRegion region = document.getLineInformation(line);
......
......@@ -18,6 +18,9 @@
package org.jkiss.dbeaver.ext.erd.editor;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.draw2d.*;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Insets;
......@@ -60,6 +63,7 @@ import org.eclipse.ui.model.WorkbenchAdapter;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.PropertySheetPage;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.core.Log;
import org.jkiss.dbeaver.ext.erd.Activator;
import org.jkiss.dbeaver.ext.erd.ERDConstants;
......@@ -960,11 +964,18 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
if (entityDiagram != null) {
List<String> errorMessages = entityDiagram.getErrorMessages();
if (!errorMessages.isEmpty()) {
// log.debug(message);
List<Status> messageStatuses = new ArrayList<Status>(errorMessages.size());
for (String error : errorMessages) {
messageStatuses.add(new Status(Status.ERROR, DBeaverCore.getCorePluginID(), error));
}
MultiStatus status = new MultiStatus(DBeaverCore.getCorePluginID(), 0, messageStatuses.toArray(new IStatus[messageStatuses.size()]), null, null);
UIUtils.showErrorDialog(
control.getShell(),
"Diagram loading errors",
"Error(s) occurred during diagram loading. If these errors are recoverable then fix errors and then refresh/reopen diagram",
errorMessages);
status);
}
setInfo(entityDiagram.getEntityCount() + " objects");
} else {
......
......@@ -30,7 +30,7 @@ import org.jkiss.dbeaver.ext.mysql.model.MySQLGrant;
import org.jkiss.dbeaver.ext.mysql.model.MySQLPrivilege;
import org.jkiss.dbeaver.ext.mysql.model.MySQLUser;
import org.jkiss.dbeaver.model.edit.DBECommandReflector;
import org.jkiss.dbeaver.model.edit.prop.ControlPropertyCommandListener;
import org.jkiss.dbeaver.ui.editors.ControlPropertyCommandListener;
import org.jkiss.dbeaver.model.impl.edit.DBECommandAdapter;
import org.jkiss.dbeaver.runtime.load.DatabaseLoadService;
import org.jkiss.dbeaver.runtime.load.LoadingUtils;
......
......@@ -82,7 +82,7 @@ public abstract class MySQLDatabaseWizardPageSettings<WIZARD extends AbstractToo
@Override
public void widgetSelected(SelectionEvent e)
{
BaseAuthDialog authDialog = new BaseAuthDialog(getShell(), "Authentication", null);
BaseAuthDialog authDialog = new BaseAuthDialog(getShell(), "Authentication");
authDialog.setUserName(wizard.getToolUserName());
authDialog.setUserPassword(wizard.getToolUserPassword());
authDialog.setSavePassword(savePassword);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册