提交 8b1dac78 编写于 作者: J jurgen

Properties moved to runtime

Former-commit-id: 13b92937
上级 9c6671ec
......@@ -33,17 +33,17 @@ import org.jkiss.dbeaver.runtime.properties.PropertySourceAbstract;
public interface DBDValueHandler
{
// Default value, means no features are supported
public static final int FEATURE_NONE = 0;
int FEATURE_NONE = 0;
// VIEWER is ability to render value editor in separate panel
public static final int FEATURE_VIEWER = 1;
int FEATURE_VIEWER = 1;
// EDITOR is ability to show value editor in separate dialog or standalone editor
public static final int FEATURE_EDITOR = 2;
int FEATURE_EDITOR = 2;
// INLINE_EDITOR is ability to show editor in grid cell
public static final int FEATURE_INLINE_EDITOR = 4;
int FEATURE_INLINE_EDITOR = 4;
// SHOW_ICON means grid should render type icon before cell value
public static final int FEATURE_SHOW_ICON = 8;
int FEATURE_SHOW_ICON = 8;
// FEATURE_COMPOSITE composite values (which doesn't have their own "value" but have nested valuable elements)
public static final int FEATURE_COMPOSITE = 16;
int FEATURE_COMPOSITE = 16;
/**
* Handler features. Bit set.
......
......@@ -18,7 +18,7 @@
package org.jkiss.dbeaver.model.impl.data.formatters;
import org.jkiss.dbeaver.model.data.DBDBinaryFormatter;
import org.jkiss.dbeaver.ui.editors.binary.HexUtils;
import org.jkiss.dbeaver.utils.TextUtils;
/**
* 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 = HexUtils.byteToHex[bytes[i] & 0x0ff];
String hex = TextUtils.byteToHex[bytes[i] & 0x0ff];
chars[i * 2] = hex.charAt(0);
chars[i * 2 + 1] = hex.charAt(1);
}
......
......@@ -24,7 +24,7 @@ import org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableColumn;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import org.jkiss.utils.CommonUtils;
import java.util.Set;
......
......@@ -22,7 +22,7 @@ import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.struct.DBSEntityConstraintType;
import org.jkiss.dbeaver.model.struct.rdb.DBSForeignKeyModifyRule;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableForeignKey;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
/**
* JDBCTableForeignKey
......
......@@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.runtime.properties;
package org.jkiss.dbeaver.model.meta;
/**
* Property value provider
......
......@@ -18,8 +18,6 @@
package org.jkiss.dbeaver.model.meta;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
......@@ -32,9 +30,9 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
public @interface Property
{
public static final String DEFAULT_LOCAL_STRING = "#"; //NON-NLS-1
public static final String RESOURCE_TYPE_NAME = "name"; //NON-NLS-1
public static final String RESOURCE_TYPE_DESCRIPTION = "description"; //NON-NLS-1
String DEFAULT_LOCAL_STRING = "#"; //NON-NLS-1
String RESOURCE_TYPE_NAME = "name"; //NON-NLS-1
String RESOURCE_TYPE_DESCRIPTION = "description"; //NON-NLS-1
/**
* Property unique ID (unique within class)
......
......@@ -20,14 +20,12 @@ package org.jkiss.dbeaver.runtime.jobs;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.progress.IProgressConstants;
import org.jkiss.dbeaver.core.CoreMessages;
import org.jkiss.dbeaver.model.DBPConnectionEventType;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.registry.DataSourceDescriptor;
import org.jkiss.dbeaver.runtime.AbstractJob;
import org.jkiss.dbeaver.runtime.RuntimeUtils;
import org.jkiss.dbeaver.ui.DBeaverIcons;
/**
* Connect job.
......@@ -45,7 +43,6 @@ public class ConnectJob extends EventProcessorJob
{
super(NLS.bind(CoreMessages.runtime_jobs_connect_name, container.getName()), container);
setUser(true);
setProperty(IProgressConstants.ICON_PROPERTY, DBeaverIcons.getImageDescriptor(container.getDriver().getIcon()));
}
public IStatus getConnectStatus() {
......
......@@ -20,7 +20,6 @@ package org.jkiss.dbeaver.runtime.jobs;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.progress.IProgressConstants;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.DBPDataSource;
......@@ -28,7 +27,6 @@ import org.jkiss.dbeaver.model.DBPDataSourceUser;
import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
import org.jkiss.dbeaver.model.struct.DBSDataSourceContainer;
import org.jkiss.dbeaver.runtime.AbstractJob;
import org.jkiss.dbeaver.ui.DBeaverIcons;
/**
* DataSourceJob
......@@ -44,12 +42,6 @@ public abstract class DataSourceJob extends AbstractJob implements DBPDataSource
final DBSDataSourceContainer dataSourceContainer = executionContext.getDataSource().getContainer();
setUser(true);
//setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
//setProperty(IProgressConstants.KEEPONE_PROPERTY, Boolean.TRUE);
if (image == null) {
image = DBeaverIcons.getImageDescriptor(dataSourceContainer.getDriver().getIcon());
}
setProperty(IProgressConstants.ICON_PROPERTY, image);
addJobChangeListener(new JobChangeAdapter() {
@Override
......
......@@ -22,6 +22,7 @@ import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.DBPPersistedObject;
import org.jkiss.dbeaver.model.DBPPropertyDescriptor;
import org.jkiss.dbeaver.model.DBPPropertySource;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueTransformer;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
......
......@@ -22,6 +22,7 @@ import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.core.Log;
import org.jkiss.dbeaver.model.DBPPropertyDescriptor;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import org.jkiss.dbeaver.runtime.RuntimeUtils;
import org.jkiss.utils.ArrayUtils;
import org.jkiss.utils.CommonUtils;
......
......@@ -68,7 +68,7 @@ import org.jkiss.dbeaver.ui.dialogs.ConfirmationDialog;
import org.jkiss.dbeaver.ui.dialogs.StandardErrorDialog;
import org.jkiss.dbeaver.ui.dialogs.driver.DriverEditDialog;
import org.jkiss.dbeaver.ui.editors.text.BaseTextEditor;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.utils.ArrayUtils;
import org.jkiss.utils.BeanUtils;
......
......@@ -28,6 +28,7 @@ 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;
......@@ -78,7 +79,7 @@ public class HexEditControl extends Composite {
// Compose header row
StringBuilder rowChars = new StringBuilder();
for (int i = 0; i < maxScreenResolution / minCharSize / 3; ++i)
rowChars.append(HexUtils.byteToHex[i & 0x0ff]).append(' ');
rowChars.append(TextUtils.byteToHex[i & 0x0ff]).append(' ');
headerRow = rowChars.toString().toUpperCase();
}
......@@ -841,10 +842,10 @@ public class HexEditControl extends Composite {
else
theText.append('0');
} else {
theText.append(HexUtils.nibbleToHex[nibble]);
theText.append(TextUtils.nibbleToHex[nibble]);
}
}
theText.append(HexUtils.nibbleToHex[((int) address) & 0x0f]).append(':');
theText.append(TextUtils.nibbleToHex[((int) address) & 0x0f]).append(':');
}
return theText;
......@@ -859,7 +860,7 @@ public class HexEditControl extends Composite {
if (isHexOutput) {
result = new StringBuilder(length * 3);
for (int i = 0; i < length; ++i) {
result.append(HexUtils.byteToHex[tmpRawBuffer[i] & 0x0ff]).append(' ');
result.append(TextUtils.byteToHex[tmpRawBuffer[i] & 0x0ff]).append(' ');
}
} else {
result = new StringBuilder(length);
......@@ -934,7 +935,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, HexUtils.byteToHex[tmpRawBuffer[0] & 0x0ff]);
hexText.replaceTextRange(offset * 3, 2, TextUtils.byteToHex[tmpRawBuffer[0] & 0x0ff]);
hexText.setStyleRange(new StyleRange(offset * 3, 2, COLOR_BLUE, null));
previewText.replaceTextRange(
offset,
......
/*
* 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.ui.editors.binary;
/**
* Hex utils
*/
public class HexUtils {
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 {
// Compose byte to hex map
for (int i = 0; i < 256; ++i) {
HexUtils.byteToHex[i] = Character.toString(HexUtils.nibbleToHex[i >>> 4]) + HexUtils.nibbleToHex[i & 0x0f];
}
}
}
......@@ -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.ui.editors.binary.HexUtils;
import org.jkiss.dbeaver.utils.TextUtils;
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(HexUtils.byteToHex[selection[i] & 0x0ff]);
selectedText.append(TextUtils.byteToHex[selection[i] & 0x0ff]);
}
findGroup.textCombo.setText(selectedText.toString());
findGroup.selectText();
......
......@@ -36,8 +36,19 @@ 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);
......
......@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.ext.db2.editors;
import org.jkiss.dbeaver.ext.db2.model.DB2TableColumn;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import java.util.ArrayList;
import java.util.List;
......
......@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.ext.db2.editors;
import org.jkiss.dbeaver.ext.db2.model.DB2Table;
import org.jkiss.dbeaver.ext.db2.model.DB2Tablespace;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import java.util.ArrayList;
import java.util.Collection;
......
......@@ -33,7 +33,7 @@ import org.jkiss.dbeaver.model.meta.*;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityConstraintType;
import org.jkiss.dbeaver.model.struct.rdb.DBSForeignKeyModifyRule;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import org.jkiss.utils.CommonUtils;
import java.io.UnsupportedEncodingException;
......
......@@ -28,7 +28,7 @@ import org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTableColumn;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableColumn;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import org.jkiss.utils.CommonUtils;
import java.sql.ResultSet;
......
......@@ -27,7 +27,7 @@ import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableColumn;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import java.sql.ResultSet;
import java.sql.Types;
......
......@@ -28,7 +28,7 @@ import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityConstraintType;
import org.jkiss.dbeaver.model.struct.rdb.DBSForeignKeyModifyRule;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableForeignKey;
import org.jkiss.dbeaver.runtime.properties.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import org.jkiss.utils.CommonUtils;
import java.sql.ResultSet;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册