提交 58eec7a6 编写于 作者: S Serge Rider

#3632 Multiline cell value editor. UI model refactoring


Former-commit-id: 271d2c06
上级 f0ccb8a4
...@@ -291,7 +291,7 @@ public class DataSourceDescriptor ...@@ -291,7 +291,7 @@ public class DataSourceDescriptor
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 2) @Property(viewable = true, multiline = true, order = 2)
public String getDescription() public String getDescription()
{ {
return description; return description;
......
...@@ -439,7 +439,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver ...@@ -439,7 +439,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
} }
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return description; return description;
......
...@@ -365,7 +365,7 @@ public class DB2DataType extends DB2Object<DBSObject> implements DBSDataType, DB ...@@ -365,7 +365,7 @@ public class DB2DataType extends DB2Object<DBSObject> implements DBSDataType, DB
@Nullable @Nullable
@Override @Override
@Property(viewable = false, editable = false) @Property(viewable = false, editable = false, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -253,7 +253,7 @@ public class DB2Index extends JDBCTableIndex<DB2Schema, DB2TableBase> { ...@@ -253,7 +253,7 @@ public class DB2Index extends JDBCTableIndex<DB2Schema, DB2TableBase> {
@Nullable @Nullable
@Override @Override
@Property(viewable = false, editable = false) @Property(viewable = false, editable = false, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -215,7 +215,7 @@ public class DB2Package extends DB2SchemaObject implements DBPRefreshableObject ...@@ -215,7 +215,7 @@ public class DB2Package extends DB2SchemaObject implements DBPRefreshableObject
@Nullable @Nullable
@Override @Override
@Property(viewable = false, order = 9) @Property(viewable = false, multiline = true, order = 9)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -373,7 +373,7 @@ public class DB2Routine extends DB2Object<DBSObject> ...@@ -373,7 +373,7 @@ public class DB2Routine extends DB2Object<DBSObject>
@Nullable @Nullable
@Override @Override
@Property(viewable = false) @Property(viewable = false, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -497,7 +497,7 @@ public class DB2Schema extends DB2GlobalObject implements DBSSchema, DBPRefresha ...@@ -497,7 +497,7 @@ public class DB2Schema extends DB2GlobalObject implements DBSSchema, DBPRefresha
@Nullable @Nullable
@Override @Override
@Property(viewable = false, editable = false) @Property(viewable = false, editable = false, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -306,7 +306,7 @@ public class DB2Sequence extends DB2SchemaObject implements DBSSequence, DBPRefr ...@@ -306,7 +306,7 @@ public class DB2Sequence extends DB2SchemaObject implements DBSSequence, DBPRefr
@Nullable @Nullable
@Override @Override
@Property(viewable = false, editable = true, updatable = true) @Property(viewable = false, editable = true, updatable = true, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -125,7 +125,7 @@ public class DB2StorageGroup extends DB2GlobalObject implements DBPNamedObject { ...@@ -125,7 +125,7 @@ public class DB2StorageGroup extends DB2GlobalObject implements DBPNamedObject {
@Nullable @Nullable
@Override @Override
@Property(viewable = false) @Property(viewable = false, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -253,7 +253,7 @@ public abstract class DB2TableBase extends JDBCTable<DB2DataSource, DB2Schema> ...@@ -253,7 +253,7 @@ public abstract class DB2TableBase extends JDBCTable<DB2DataSource, DB2Schema>
@Nullable @Nullable
@Override @Override
@Property(viewable = false, order = 99, editable = true, updatable = true) @Property(viewable = false, order = 99, editable = true, updatable = true, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -317,7 +317,7 @@ public class DB2TableColumn extends JDBCTableColumn<DB2TableBase> ...@@ -317,7 +317,7 @@ public class DB2TableColumn extends JDBCTableColumn<DB2TableBase>
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 999, editable = true, updatable = true) @Property(viewable = true, order = 999, editable = true, updatable = true, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -141,7 +141,7 @@ public class DB2TableUniqueKey extends JDBCTableConstraint<DB2Table> { ...@@ -141,7 +141,7 @@ public class DB2TableUniqueKey extends JDBCTableConstraint<DB2Table> {
@Nullable @Nullable
@Override @Override
@Property(viewable = true, editable = false, order = 4) @Property(viewable = true, editable = false, multiline = true, order = 4)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -261,7 +261,7 @@ public class DB2Tablespace extends DB2GlobalObject implements DBPNamedObject, DB ...@@ -261,7 +261,7 @@ public class DB2Tablespace extends DB2GlobalObject implements DBPNamedObject, DB
@Nullable @Nullable
@Override @Override
@Property(viewable = false) @Property(viewable = false, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -339,7 +339,7 @@ public class DB2Trigger extends DB2SchemaObject implements DBSTrigger, DB2Source ...@@ -339,7 +339,7 @@ public class DB2Trigger extends DB2SchemaObject implements DBSTrigger, DB2Source
@Nullable @Nullable
@Override @Override
@Property(viewable = false) @Property(viewable = false, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -135,7 +135,7 @@ public abstract class DB2ViewBase extends DB2TableBase implements DB2SourceObjec ...@@ -135,7 +135,7 @@ public abstract class DB2ViewBase extends DB2TableBase implements DB2SourceObjec
@Nullable @Nullable
@Override @Override
@Property(viewable = false, editable = false, updatable = false) @Property(viewable = false, editable = false, updatable = false, multiline = true)
public String getDescription() public String getDescription()
{ {
return super.getDescription(); return super.getDescription();
......
...@@ -178,7 +178,7 @@ public class DB2XMLSchema extends DB2SchemaObject implements DBPRefreshableObjec ...@@ -178,7 +178,7 @@ public class DB2XMLSchema extends DB2SchemaObject implements DBPRefreshableObjec
@Nullable @Nullable
@Override @Override
@Property(viewable = false, order = 20, updatable = true) @Property(viewable = false, order = 20, updatable = true, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -114,7 +114,7 @@ public class DB2RemoteServer extends DB2GlobalObject implements DBPRefreshableOb ...@@ -114,7 +114,7 @@ public class DB2RemoteServer extends DB2GlobalObject implements DBPRefreshableOb
return version; return version;
} }
@Property(viewable = true, editable = false, order = 5) @Property(viewable = true, editable = false, multiline = true, order = 5)
public String getRemarks() public String getRemarks()
{ {
return remarks; return remarks;
......
...@@ -91,7 +91,7 @@ public class DB2RemoteServerOption extends DB2Object<DB2RemoteServer> { ...@@ -91,7 +91,7 @@ public class DB2RemoteServerOption extends DB2Object<DB2RemoteServer> {
return createTime; return createTime;
} }
@Property(viewable = true, editable = false, order = 5) @Property(viewable = true, editable = false, multiline = true, order = 5)
public String getRemarks() public String getRemarks()
{ {
return remarks; return remarks;
......
...@@ -115,7 +115,7 @@ public class DB2Wrapper extends DB2GlobalObject implements DBPRefreshableObject ...@@ -115,7 +115,7 @@ public class DB2Wrapper extends DB2GlobalObject implements DBPRefreshableObject
return library; return library;
} }
@Property(viewable = true, order = 5) @Property(viewable = true, multiline = true, order = 5)
public String getRemarks() public String getRemarks()
{ {
return remarks; return remarks;
......
...@@ -209,7 +209,7 @@ public class DB2Module extends DB2SchemaObject implements DBSProcedureContainer, ...@@ -209,7 +209,7 @@ public class DB2Module extends DB2SchemaObject implements DBSProcedureContainer,
@Nullable @Nullable
@Override @Override
@Property(viewable = false) @Property(viewable = false, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -131,7 +131,7 @@ public class DB2Role extends DB2Grantee implements DBPSaveableObject, DBARole, D ...@@ -131,7 +131,7 @@ public class DB2Role extends DB2Grantee implements DBPSaveableObject, DBARole, D
@Nullable @Nullable
@Override @Override
@Property(viewable = true) @Property(viewable = true, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -194,7 +194,7 @@ public class ExasolBaseObjectGrant implements DBAPrivilege { ...@@ -194,7 +194,7 @@ public class ExasolBaseObjectGrant implements DBAPrivilege {
} }
@Override @Override
@Property(hidden = true) @Property(hidden = true, multiline = true)
public String getDescription() public String getDescription()
{ {
// No Description available // No Description available
......
...@@ -60,7 +60,7 @@ public class ExasolConnectionGrant ...@@ -60,7 +60,7 @@ public class ExasolConnectionGrant
} }
@Override @Override
@Property(hidden = true) @Property(hidden = true, multiline = true)
public String getDescription() public String getDescription()
{ {
return null; return null;
......
...@@ -67,7 +67,7 @@ public class ExasolRole extends ExasolGrantee implements DBARole, DBPNamedObjec ...@@ -67,7 +67,7 @@ public class ExasolRole extends ExasolGrantee implements DBARole, DBPNamedObjec
return name; return name;
} }
@Property(viewable = true, updatable=true, editable=true, order = 10) @Property(viewable = true, updatable=true, editable=true, multiline = true, order = 10)
public String getDescription() { public String getDescription() {
return description; return description;
} }
......
...@@ -58,7 +58,7 @@ public class ExasolSystemGrant implements DBAPrivilege { ...@@ -58,7 +58,7 @@ public class ExasolSystemGrant implements DBAPrivilege {
} }
@Override @Override
@Property(hidden=true) @Property(hidden=true, multiline = true)
public String getDescription() public String getDescription()
{ {
return ""; return "";
......
...@@ -81,7 +81,7 @@ public class ExasolUser extends ExasolGrantee ...@@ -81,7 +81,7 @@ public class ExasolUser extends ExasolGrantee
} }
@Override @Override
@Property(viewable = true, updatable=true, editable=true, order = 100) @Property(viewable = true, updatable=true, editable=true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return this.description; return this.description;
......
...@@ -124,7 +124,7 @@ public class ExasolConnection ...@@ -124,7 +124,7 @@ public class ExasolConnection
} }
@Override @Override
@Property(viewable = true, editable= true, updatable=true, order = 50) @Property(viewable = true, editable= true, updatable=true, multiline = true, order = 50)
public String getDescription() public String getDescription()
{ {
return this.comment; return this.comment;
......
...@@ -255,7 +255,7 @@ public class ExasolDataType extends ExasolObject<DBSObject> implements DBSDataTy ...@@ -255,7 +255,7 @@ public class ExasolDataType extends ExasolObject<DBSObject> implements DBSDataTy
@Nullable @Nullable
@Override @Override
@Property(viewable = false, editable = false) @Property(viewable = false, editable = false, multiline = true)
public String getDescription() { public String getDescription() {
return null; return null;
} }
......
...@@ -113,7 +113,7 @@ public class ExasolFunction ...@@ -113,7 +113,7 @@ public class ExasolFunction
@Nullable @Nullable
@Override @Override
@Property(viewable = true, editable = true, updatable = true, order = 11) @Property(viewable = true, editable = true, updatable = true, multiline = true, order = 11)
public String getDescription() { public String getDescription() {
return this.remarks; return this.remarks;
} }
......
...@@ -246,7 +246,7 @@ public class ExasolSchema extends ExasolGlobalObject implements DBSSchema, DBPNa ...@@ -246,7 +246,7 @@ public class ExasolSchema extends ExasolGlobalObject implements DBSSchema, DBPNa
return createTime; return createTime;
} }
@Property(viewable = true, editable = true, updatable = true, order = 3) @Property(viewable = true, editable = true, updatable = true, multiline = true, order = 3)
public String getDescription() { public String getDescription() {
return remarks; return remarks;
} }
......
...@@ -112,7 +112,7 @@ public class ExasolScript extends AbstractProcedure<ExasolDataSource, ExasolSche ...@@ -112,7 +112,7 @@ public class ExasolScript extends AbstractProcedure<ExasolDataSource, ExasolSche
@Nullable @Nullable
@Override @Override
@Property(viewable = true, editable = true, updatable = true, order = 11) @Property(viewable = true, editable = true, updatable = true, multiline = true, order = 11)
public String getDescription() { public String getDescription() {
return this.remarks; return this.remarks;
} }
......
...@@ -63,7 +63,7 @@ public abstract class ExasolTableBase extends JDBCTable<ExasolDataSource, Exasol ...@@ -63,7 +63,7 @@ public abstract class ExasolTableBase extends JDBCTable<ExasolDataSource, Exasol
@Nullable @Nullable
@Override @Override
@Property(viewable = false, order = 99, editable = true, updatable = true) @Property(viewable = false, order = 99, editable = true, updatable = true, multiline = true)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -234,7 +234,7 @@ public class ExasolTableColumn extends JDBCTableColumn<ExasolTableBase> ...@@ -234,7 +234,7 @@ public class ExasolTableColumn extends JDBCTableColumn<ExasolTableBase>
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 999, editable = true, updatable = true) @Property(viewable = true, order = 999, editable = true, updatable = true, multiline = true)
public String getDescription() { public String getDescription() {
return remarks; return remarks;
} }
......
...@@ -117,7 +117,7 @@ public class ExasolTableUniqueKey extends JDBCTableConstraint<ExasolTable> imple ...@@ -117,7 +117,7 @@ public class ExasolTableUniqueKey extends JDBCTableConstraint<ExasolTable> imple
@Nullable @Nullable
@Override @Override
@Property(viewable = false, editable = false, order = 4) @Property(viewable = false, editable = false, multiline = true, order = 4)
public String getDescription() { public String getDescription() {
return null; return null;
} }
......
...@@ -77,7 +77,7 @@ public class ExasolView extends ExasolTableBase implements ExasolSourceObject { ...@@ -77,7 +77,7 @@ public class ExasolView extends ExasolTableBase implements ExasolSourceObject {
@Override @Override
@Property(viewable = true, editable = false, updatable = false, order = 40) @Property(viewable = true, editable = false, updatable = false, multiline = true, order = 40)
public String getDescription() { public String getDescription() {
return super.getDescription(); return super.getDescription();
} }
......
...@@ -45,7 +45,7 @@ public class GenericDataType extends JDBCDataType<GenericStructContainer> ...@@ -45,7 +45,7 @@ public class GenericDataType extends JDBCDataType<GenericStructContainer>
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return super.getDescription(); return super.getDescription();
......
...@@ -71,7 +71,7 @@ public class GenericSchema extends GenericObjectContainer implements DBSSchema ...@@ -71,7 +71,7 @@ public class GenericSchema extends GenericObjectContainer implements DBSSchema
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return null; return null;
......
...@@ -63,7 +63,7 @@ public class GenericSequence implements DBSSequence, DBPQualifiedObject ...@@ -63,7 +63,7 @@ public class GenericSequence implements DBSSequence, DBPQualifiedObject
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 10) @Property(viewable = true, multiline = true, order = 10)
public String getDescription() { public String getDescription() {
return description; return description;
} }
......
...@@ -56,7 +56,7 @@ public abstract class GenericSynonym implements DBSAlias, DBSObject, DBPQualifie ...@@ -56,7 +56,7 @@ public abstract class GenericSynonym implements DBSAlias, DBSObject, DBPQualifie
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 10) @Property(viewable = true, multiline = true, order = 10)
public String getDescription() { public String getDescription() {
return description; return description;
} }
......
...@@ -210,7 +210,7 @@ public class GenericTable extends JDBCTable<GenericDataSource, GenericStructCont ...@@ -210,7 +210,7 @@ public class GenericTable extends JDBCTable<GenericDataSource, GenericStructCont
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return description; return description;
......
...@@ -162,7 +162,7 @@ public class GenericTableColumn extends JDBCTableColumn<GenericTable> implements ...@@ -162,7 +162,7 @@ public class GenericTableColumn extends JDBCTableColumn<GenericTable> implements
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return remarks; return remarks;
......
...@@ -80,7 +80,7 @@ public class GenericTableIndex extends JDBCTableIndex<GenericStructContainer, Ge ...@@ -80,7 +80,7 @@ public class GenericTableIndex extends JDBCTableIndex<GenericStructContainer, Ge
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return null; return null;
......
...@@ -55,7 +55,7 @@ public class GenericTrigger implements DBSTrigger, GenericScriptObject ...@@ -55,7 +55,7 @@ public class GenericTrigger implements DBSTrigger, GenericScriptObject
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return description; return description;
......
...@@ -51,7 +51,7 @@ public class SQLServerTable extends GenericTable implements DBPOverloadedObject ...@@ -51,7 +51,7 @@ public class SQLServerTable extends GenericTable implements DBPOverloadedObject
return super.getDescription(); return super.getDescription();
} }
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription(DBRProgressMonitor monitor) throws DBException { public String getDescription(DBRProgressMonitor monitor) throws DBException {
String description = getDescription(); String description = getDescription();
if (description != null || !isSqlServer()) { if (description != null || !isSqlServer()) {
......
...@@ -101,7 +101,7 @@ public class MySQLCharset extends MySQLInformation { ...@@ -101,7 +101,7 @@ public class MySQLCharset extends MySQLInformation {
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return description; return description;
......
...@@ -110,7 +110,7 @@ public class MySQLEvent extends MySQLInformation implements MySQLSourceObject { ...@@ -110,7 +110,7 @@ public class MySQLEvent extends MySQLInformation implements MySQLSourceObject {
@Nullable @Nullable
@Override @Override
@Property(viewable = true, category = CAT_DETAILS, order = 100) @Property(viewable = true, multiline = true, category = CAT_DETAILS, order = 100)
public String getDescription() public String getDescription()
{ {
return eventComment; return eventComment;
......
...@@ -157,7 +157,7 @@ public class MySQLPartition extends JDBCTableObject<MySQLTable> ...@@ -157,7 +157,7 @@ public class MySQLPartition extends JDBCTableObject<MySQLTable>
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 5) @Property(viewable = true, multiline = true, order = 5)
public String getDescription() public String getDescription()
{ {
return description; return description;
...@@ -223,7 +223,7 @@ public class MySQLPartition extends JDBCTableObject<MySQLTable> ...@@ -223,7 +223,7 @@ public class MySQLPartition extends JDBCTableObject<MySQLTable>
return checksum; return checksum;
} }
@Property(viewable = true, order = 16) @Property(viewable = true, multiline = true, order = 16)
public String getComment() public String getComment()
{ {
return comment; return comment;
......
...@@ -72,7 +72,7 @@ public class MySQLTable extends MySQLTableBase ...@@ -72,7 +72,7 @@ public class MySQLTable extends MySQLTableBase
@Property(viewable = true, editable = true, updatable = true, order = 4) public long getAutoIncrement() { return autoIncrement; } @Property(viewable = true, editable = true, updatable = true, order = 4) public long getAutoIncrement() { return autoIncrement; }
@Property(viewable = false, editable = true, updatable = true, listProvider = CharsetListProvider.class, order = 5) public MySQLCharset getCharset() { return charset; } @Property(viewable = false, editable = true, updatable = true, listProvider = CharsetListProvider.class, order = 5) public MySQLCharset getCharset() { return charset; }
@Property(viewable = false, editable = true, updatable = true, listProvider = CollationListProvider.class, order = 6) public MySQLCollation getCollation() { return collation; } @Property(viewable = false, editable = true, updatable = true, listProvider = CollationListProvider.class, order = 6) public MySQLCollation getCollation() { return collation; }
@Property(viewable = true, editable = true, updatable = true, order = 100) public String getDescription() { return description; } @Property(viewable = true, editable = true, updatable = true, multiline = true, order = 100) public String getDescription() { return description; }
@Property(category = CATEGORY_STATISTICS, viewable = true, order = 10) public long getRowCount() { return rowCount; } @Property(category = CATEGORY_STATISTICS, viewable = true, order = 10) public long getRowCount() { return rowCount; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 11) public long getAvgRowLength() { return avgRowLength; } @Property(category = CATEGORY_STATISTICS, viewable = false, order = 11) public long getAvgRowLength() { return avgRowLength; }
......
...@@ -329,7 +329,7 @@ public class MySQLTableColumn extends JDBCTableColumn<MySQLTableBase> implements ...@@ -329,7 +329,7 @@ public class MySQLTableColumn extends JDBCTableColumn<MySQLTableBase> implements
this.collation = collation; this.collation = collation;
} }
@Property(viewable = true, editable = true, updatable = true, order = 100) @Property(viewable = true, editable = true, updatable = true, multiline = true, order = 100)
public String getComment() public String getComment()
{ {
return comment; return comment;
......
...@@ -106,7 +106,7 @@ public class MySQLTableIndex extends JDBCTableIndex<MySQLCatalog, MySQLTable> im ...@@ -106,7 +106,7 @@ public class MySQLTableIndex extends JDBCTableIndex<MySQLCatalog, MySQLTable> im
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return indexComment; return indexComment;
......
...@@ -152,7 +152,7 @@ public abstract class OracleTrigger<PARENT extends DBSObject> extends OracleObje ...@@ -152,7 +152,7 @@ public abstract class OracleTrigger<PARENT extends DBSObject> extends OracleObje
@Nullable @Nullable
@Override @Override
@Property(order = 11) @Property(multiline = true, order = 11)
public String getDescription() public String getDescription()
{ {
return description; return description;
......
...@@ -248,7 +248,7 @@ public abstract class PostgreAttribute<OWNER extends DBSEntity & PostgreObject> ...@@ -248,7 +248,7 @@ public abstract class PostgreAttribute<OWNER extends DBSEntity & PostgreObject>
@Nullable @Nullable
@Override @Override
@Property(viewable = true, editable = true, updatable = true, order = 100) @Property(viewable = true, editable = true, updatable = true, multiline = true, order = 100)
public String getDescription() { public String getDescription() {
return description; return description;
} }
......
...@@ -160,7 +160,7 @@ public class PostgreIndex extends JDBCTableIndex<PostgreSchema, PostgreTableBase ...@@ -160,7 +160,7 @@ public class PostgreIndex extends JDBCTableIndex<PostgreSchema, PostgreTableBase
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return description; return description;
......
...@@ -461,7 +461,7 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg ...@@ -461,7 +461,7 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
@Nullable @Nullable
@Override @Override
@Property(viewable = true, editable = true, updatable = true, order = 200) @Property(viewable = true, editable = true, updatable = true, multiline = true, order = 200)
public String getDescription() public String getDescription()
{ {
return super.getDescription(); return super.getDescription();
......
...@@ -52,7 +52,7 @@ public class SQLiteDataType extends JDBCDataType<SQLiteDataSource> { ...@@ -52,7 +52,7 @@ public class SQLiteDataType extends JDBCDataType<SQLiteDataSource> {
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return super.getDescription(); return super.getDescription();
......
...@@ -104,7 +104,7 @@ public class VerticaProjectionColumn extends JDBCTableColumn<VerticaProjection> ...@@ -104,7 +104,7 @@ public class VerticaProjectionColumn extends JDBCTableColumn<VerticaProjection>
return super.getDescription(); return super.getDescription();
} }
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription(DBRProgressMonitor monitor) throws DBException { public String getDescription(DBRProgressMonitor monitor) throws DBException {
return description; return description;
} }
......
...@@ -62,7 +62,7 @@ public class VerticaTableColumn extends GenericTableColumn ...@@ -62,7 +62,7 @@ public class VerticaTableColumn extends GenericTableColumn
@Nullable @Nullable
@Override @Override
@Property(viewable = true, editable = true, updatable = true, order = 100) @Property(viewable = true, editable = true, updatable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return super.getDescription(); return super.getDescription();
......
...@@ -68,6 +68,7 @@ Export-Package: org.jkiss.dbeaver, ...@@ -68,6 +68,7 @@ Export-Package: org.jkiss.dbeaver,
org.jkiss.dbeaver.runtime, org.jkiss.dbeaver.runtime,
org.jkiss.dbeaver.runtime.jobs, org.jkiss.dbeaver.runtime.jobs,
org.jkiss.dbeaver.runtime.net, org.jkiss.dbeaver.runtime.net,
org.jkiss.dbeaver.runtime.properties,
org.jkiss.dbeaver.runtime.ui, org.jkiss.dbeaver.runtime.ui,
org.jkiss.dbeaver.utils org.jkiss.dbeaver.utils
Bundle-ClassPath: . Bundle-ClassPath: .
......
...@@ -72,7 +72,7 @@ public abstract class AbstractProcedure< ...@@ -72,7 +72,7 @@ public abstract class AbstractProcedure<
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return description; return description;
......
...@@ -86,7 +86,7 @@ public abstract class AbstractTrigger implements DBSTrigger, DBPQualifiedObject, ...@@ -86,7 +86,7 @@ public abstract class AbstractTrigger implements DBSTrigger, DBPQualifiedObject,
@Nullable @Nullable
@Override @Override
@Property(viewable = true, order = 100) @Property(viewable = true, multiline = true, order = 100)
public String getDescription() public String getDescription()
{ {
return description; return description;
......
/* /*
* DBeaver - Universal Database Manager * DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org) * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jkiss.dbeaver.runtime.properties; package org.jkiss.dbeaver.runtime.properties;
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor; import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
/** /**
* Lazy properties listener * Lazy properties listener
*/ */
public interface ILazyPropertyLoadListener { public interface ILazyPropertyLoadListener {
void handlePropertyLoad(Object object, DBPPropertyDescriptor property, Object propertyValue, boolean completed); void handlePropertyLoad(Object object, DBPPropertyDescriptor property, Object propertyValue, boolean completed);
} }
/* /*
* DBeaver - Universal Database Manager * DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org) * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jkiss.dbeaver.runtime.properties; package org.jkiss.dbeaver.runtime.properties;
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor; import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
/** /**
* Interface for filters. Can accept or reject items. * Interface for filters. Can accept or reject items.
*/ */
public interface IPropertyFilter { public interface IPropertyFilter {
/** /**
* Determines if the given property passes this filter. * Determines if the given property passes this filter.
*/ */
boolean select(DBPPropertyDescriptor toTest); boolean select(DBPPropertyDescriptor toTest);
} }
/* /*
* DBeaver - Universal Database Manager * DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org) * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jkiss.dbeaver.runtime.properties; package org.jkiss.dbeaver.runtime.properties;
import org.jkiss.dbeaver.model.edit.DBECommandContext; import org.jkiss.dbeaver.model.edit.DBECommandContext;
/** /**
* Editable property source * Editable property source
*/ */
public interface IPropertySourceEditable { public interface IPropertySourceEditable {
boolean isEditable(Object object); boolean isEditable(Object object);
DBECommandContext getCommandContext(); DBECommandContext getCommandContext();
// void addPropertySourceListener(IPropertySourceListener listener); // void addPropertySourceListener(IPropertySourceListener listener);
// void removePropertySourceListener(IPropertySourceListener listener); // void removePropertySourceListener(IPropertySourceListener listener);
} }
/* /*
* DBeaver - Universal Database Manager * DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org) * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jkiss.dbeaver.runtime.properties; package org.jkiss.dbeaver.runtime.properties;
import org.jkiss.code.Nullable; import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.preferences.DBPPropertySource; import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
/** /**
* Property source which allows editing of multiple objects. * Property source which allows editing of multiple objects.
*/ */
public interface IPropertySourceMulti extends DBPPropertySource { public interface IPropertySourceMulti extends DBPPropertySource {
boolean isPropertySet(Object object, ObjectPropertyDescriptor id); boolean isPropertySet(Object object, ObjectPropertyDescriptor id);
Object getPropertyValue(@Nullable DBRProgressMonitor monitor, Object object, ObjectPropertyDescriptor prop); Object getPropertyValue(@Nullable DBRProgressMonitor monitor, Object object, ObjectPropertyDescriptor prop);
boolean isPropertyResettable(Object object, ObjectPropertyDescriptor prop); boolean isPropertyResettable(Object object, ObjectPropertyDescriptor prop);
void resetPropertyValue(@Nullable DBRProgressMonitor monitor, Object object, ObjectPropertyDescriptor prop); void resetPropertyValue(@Nullable DBRProgressMonitor monitor, Object object, ObjectPropertyDescriptor prop);
void setPropertyValue(@Nullable DBRProgressMonitor monitor, Object object, ObjectPropertyDescriptor prop, Object value) void setPropertyValue(@Nullable DBRProgressMonitor monitor, Object object, ObjectPropertyDescriptor prop, Object value)
throws IllegalArgumentException; throws IllegalArgumentException;
} }
/* /*
* DBeaver - Universal Database Manager * DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org) * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jkiss.dbeaver.runtime.properties; package org.jkiss.dbeaver.runtime.properties;
import org.jkiss.code.NotNull; import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBConstants; import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.meta.IPropertyCacheValidator; import org.jkiss.dbeaver.model.meta.IPropertyCacheValidator;
import org.jkiss.dbeaver.model.meta.LazyProperty; import org.jkiss.dbeaver.model.meta.LazyProperty;
import org.jkiss.dbeaver.model.meta.Property; import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.meta.PropertyGroup; import org.jkiss.dbeaver.model.meta.PropertyGroup;
import org.jkiss.dbeaver.model.preferences.DBPPropertySource; import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.utils.BeanUtils; import org.jkiss.utils.BeanUtils;
import org.jkiss.utils.CommonUtils; import org.jkiss.utils.CommonUtils;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.*;
/** /**
* Abstract object attribute * Abstract object attribute
*/ */
public abstract class ObjectAttributeDescriptor { public abstract class ObjectAttributeDescriptor {
static final Log log = Log.getLog(ObjectAttributeDescriptor.class); static final Log log = Log.getLog(ObjectAttributeDescriptor.class);
public static final Comparator<ObjectAttributeDescriptor> ATTRIBUTE_DESCRIPTOR_COMPARATOR = new Comparator<ObjectAttributeDescriptor>() { public static final Comparator<ObjectAttributeDescriptor> ATTRIBUTE_DESCRIPTOR_COMPARATOR = new Comparator<ObjectAttributeDescriptor>() {
@Override @Override
public int compare(ObjectAttributeDescriptor o1, ObjectAttributeDescriptor o2) { public int compare(ObjectAttributeDescriptor o1, ObjectAttributeDescriptor o2) {
return o1.getOrderNumber() - o2.getOrderNumber(); return o1.getOrderNumber() - o2.getOrderNumber();
} }
}; };
private final DBPPropertySource source; private final DBPPropertySource source;
private ObjectPropertyGroupDescriptor parent; private ObjectPropertyGroupDescriptor parent;
private int orderNumber; private int orderNumber;
private String id; private String id;
private Method getter; private Method getter;
private boolean isLazy; private boolean isLazy;
private IPropertyCacheValidator cacheValidator; private IPropertyCacheValidator cacheValidator;
private Class<?> declaringClass; private Class<?> declaringClass;
public ObjectAttributeDescriptor( public ObjectAttributeDescriptor(
DBPPropertySource source, DBPPropertySource source,
ObjectPropertyGroupDescriptor parent, ObjectPropertyGroupDescriptor parent,
Method getter, Method getter,
String id, String id,
int orderNumber) int orderNumber)
{ {
this.source = source; this.source = source;
this.parent = parent; this.parent = parent;
this.getter = getter; this.getter = getter;
this.orderNumber = orderNumber; this.orderNumber = orderNumber;
this.id = id; this.id = id;
if (CommonUtils.isEmpty(this.id)) { if (CommonUtils.isEmpty(this.id)) {
this.id = BeanUtils.getPropertyNameFromGetter(getter.getName()); this.id = BeanUtils.getPropertyNameFromGetter(getter.getName());
} }
declaringClass = parent == null ? getter.getDeclaringClass() : parent.getDeclaringClass(); declaringClass = parent == null ? getter.getDeclaringClass() : parent.getDeclaringClass();
if (this.getter.getParameterTypes().length > 0 && getter.getParameterTypes()[0] == DBRProgressMonitor.class) { if (this.getter.getParameterTypes().length > 0 && getter.getParameterTypes()[0] == DBRProgressMonitor.class) {
this.isLazy = true; this.isLazy = true;
} }
if (isLazy) { if (isLazy) {
final LazyProperty lazyInfo = getter.getAnnotation(LazyProperty.class); final LazyProperty lazyInfo = getter.getAnnotation(LazyProperty.class);
if (lazyInfo != null) { if (lazyInfo != null) {
try { try {
cacheValidator = lazyInfo.cacheValidator().newInstance(); cacheValidator = lazyInfo.cacheValidator().newInstance();
} catch (Exception e) { } catch (Exception e) {
log.warn("Can't instantiate lazy cache validator '" + lazyInfo.cacheValidator().getName() + "'", e); log.warn("Can't instantiate lazy cache validator '" + lazyInfo.cacheValidator().getName() + "'", e);
} }
} }
} }
} }
public Class<?> getDeclaringClass() public Class<?> getDeclaringClass()
{ {
return declaringClass; return declaringClass;
} }
public DBPPropertySource getSource() public DBPPropertySource getSource()
{ {
return source; return source;
} }
public int getOrderNumber() public int getOrderNumber()
{ {
return orderNumber; return orderNumber;
} }
@NotNull @NotNull
public String getId() public String getId()
{ {
return id; return id;
} }
public Method getGetter() public Method getGetter()
{ {
return getter; return getter;
} }
public boolean isNameProperty() { public boolean isNameProperty() {
return id.equals(DBConstants.PROP_ID_NAME); return id.equals(DBConstants.PROP_ID_NAME);
} }
public boolean isRemote() public boolean isRemote()
{ {
return isLazy || parent != null && parent.isRemote(); return isLazy || parent != null && parent.isRemote();
} }
public boolean isLazy() public boolean isLazy()
{ {
return isLazy; return isLazy;
} }
public boolean isLazy(Object object, boolean checkParent) public boolean isLazy(Object object, boolean checkParent)
{ {
if (isLazy && cacheValidator != null) { if (isLazy && cacheValidator != null) {
if (parent != null) { if (parent != null) {
if (parent.isLazy(object, true)) { if (parent.isLazy(object, true)) {
return true; return true;
} }
try { try {
// Parent isn't lazy so use null progress monitor // Parent isn't lazy so use null progress monitor
object = parent.getGroupObject(object, null); object = parent.getGroupObject(object, null);
} catch (Exception e) { } catch (Exception e) {
log.debug(e); log.debug(e);
return true; return true;
} }
} }
return !cacheValidator.isPropertyCached(object, id); return !cacheValidator.isPropertyCached(object, id);
} }
return isLazy || (checkParent && parent != null && parent.isLazy(object, checkParent)); return isLazy || (checkParent && parent != null && parent.isLazy(object, checkParent));
} }
public IPropertyCacheValidator getCacheValidator() public IPropertyCacheValidator getCacheValidator()
{ {
return cacheValidator; return cacheValidator;
} }
public ObjectPropertyGroupDescriptor getParent() public ObjectPropertyGroupDescriptor getParent()
{ {
return parent; return parent;
} }
public abstract String getCategory(); public abstract String getCategory();
public abstract String getDescription(); public abstract String getDescription();
public static List<ObjectPropertyDescriptor> extractAnnotations( public static List<ObjectPropertyDescriptor> extractAnnotations(
DBPPropertySource source, DBPPropertySource source,
Class<?> theClass, Class<?> theClass,
IPropertyFilter filter) IPropertyFilter filter)
{ {
List<ObjectPropertyDescriptor> annoProps = new ArrayList<ObjectPropertyDescriptor>(); List<ObjectPropertyDescriptor> annoProps = new ArrayList<ObjectPropertyDescriptor>();
extractAnnotations(source, null, theClass, annoProps, filter); extractAnnotations(source, null, theClass, annoProps, filter);
return annoProps; return annoProps;
} }
public static List<ObjectPropertyDescriptor> extractAnnotations( public static List<ObjectPropertyDescriptor> extractAnnotations(
DBPPropertySource source, DBPPropertySource source,
Collection<Class<?>> classList, Collection<Class<?>> classList,
IPropertyFilter filter) IPropertyFilter filter)
{ {
List<ObjectPropertyDescriptor> annoProps = new ArrayList<>(); List<ObjectPropertyDescriptor> annoProps = new ArrayList<>();
for (Class<?> objectClass : classList) { for (Class<?> objectClass : classList) {
annoProps.addAll(ObjectAttributeDescriptor.extractAnnotations(source, objectClass, filter)); annoProps.addAll(ObjectAttributeDescriptor.extractAnnotations(source, objectClass, filter));
} }
Collections.sort(annoProps, ATTRIBUTE_DESCRIPTOR_COMPARATOR); Collections.sort(annoProps, ATTRIBUTE_DESCRIPTOR_COMPARATOR);
return annoProps; return annoProps;
} }
static void extractAnnotations(DBPPropertySource source, ObjectPropertyGroupDescriptor parent, Class<?> theClass, List<ObjectPropertyDescriptor> annoProps, IPropertyFilter filter) static void extractAnnotations(DBPPropertySource source, ObjectPropertyGroupDescriptor parent, Class<?> theClass, List<ObjectPropertyDescriptor> annoProps, IPropertyFilter filter)
{ {
Method[] methods = theClass.getMethods(); Method[] methods = theClass.getMethods();
Map<String, Method> passedNames = new HashMap<>(); Map<String, Method> passedNames = new HashMap<>();
for (Method method : methods) { for (Method method : methods) {
String methodFullName = method.getDeclaringClass().getName() + "." + method.getName(); String methodFullName = method.getDeclaringClass().getName() + "." + method.getName();
final Method prevMethod = passedNames.get(methodFullName); final Method prevMethod = passedNames.get(methodFullName);
if (prevMethod != null) { if (prevMethod != null) {
// The same method but probably with another return type // The same method but probably with another return type
final Class<?> prevReturnType = prevMethod.getReturnType(); final Class<?> prevReturnType = prevMethod.getReturnType();
final Class<?> newReturnType = method.getReturnType(); final Class<?> newReturnType = method.getReturnType();
if (newReturnType == null || prevReturnType == null || newReturnType == prevReturnType || !prevReturnType.isAssignableFrom(newReturnType)) { if (newReturnType == null || prevReturnType == null || newReturnType == prevReturnType || !prevReturnType.isAssignableFrom(newReturnType)) {
continue; continue;
} }
// Let it another chance. New return types seems to be subclass of previous // Let it another chance. New return types seems to be subclass of previous
} }
final PropertyGroup propGroupInfo = method.getAnnotation(PropertyGroup.class); final PropertyGroup propGroupInfo = method.getAnnotation(PropertyGroup.class);
if (propGroupInfo != null && method.getReturnType() != null) { if (propGroupInfo != null && method.getReturnType() != null) {
// Property group // Property group
ObjectPropertyGroupDescriptor groupDescriptor = new ObjectPropertyGroupDescriptor(source, parent, method, propGroupInfo, filter); ObjectPropertyGroupDescriptor groupDescriptor = new ObjectPropertyGroupDescriptor(source, parent, method, propGroupInfo, filter);
annoProps.addAll(groupDescriptor.getChildren()); annoProps.addAll(groupDescriptor.getChildren());
} else { } else {
final Property propInfo = method.getAnnotation(Property.class); final Property propInfo = method.getAnnotation(Property.class);
if (propInfo == null || !BeanUtils.isGetterName(method.getName()) || method.getReturnType() == null) { if (propInfo == null || !BeanUtils.isGetterName(method.getName()) || method.getReturnType() == null) {
continue; continue;
} }
// Single property // Single property
ObjectPropertyDescriptor desc = new ObjectPropertyDescriptor(source, parent, propInfo, method); ObjectPropertyDescriptor desc = new ObjectPropertyDescriptor(source, parent, propInfo, method);
if (filter != null && !filter.select(desc)) { if (filter != null && !filter.select(desc)) {
continue; continue;
} }
if (prevMethod != null) { if (prevMethod != null) {
// Remove previous anno // Remove previous anno
for (Iterator<ObjectPropertyDescriptor> iter = annoProps.iterator(); iter.hasNext(); ) { for (Iterator<ObjectPropertyDescriptor> iter = annoProps.iterator(); iter.hasNext(); ) {
if (iter.next().getId().equals(desc.getId())) { if (iter.next().getId().equals(desc.getId())) {
iter.remove(); iter.remove();
} }
} }
} }
annoProps.add(desc); annoProps.add(desc);
passedNames.put(methodFullName, method); passedNames.put(methodFullName, method);
} }
} }
Collections.sort(annoProps, ATTRIBUTE_DESCRIPTOR_COMPARATOR); Collections.sort(annoProps, ATTRIBUTE_DESCRIPTOR_COMPARATOR);
} }
} }
/* /*
* DBeaver - Universal Database Manager * DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org) * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jkiss.dbeaver.runtime.properties; package org.jkiss.dbeaver.runtime.properties;
import org.jkiss.dbeaver.model.meta.PropertyGroup; import org.jkiss.dbeaver.model.meta.PropertyGroup;
import org.jkiss.dbeaver.model.preferences.DBPPropertySource; import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
* ObjectPropertyDescriptor * ObjectPropertyDescriptor
*/ */
public class ObjectPropertyGroupDescriptor extends ObjectAttributeDescriptor public class ObjectPropertyGroupDescriptor extends ObjectAttributeDescriptor
{ {
private PropertyGroup groupInfo; private PropertyGroup groupInfo;
private List<ObjectPropertyDescriptor> children = new ArrayList<ObjectPropertyDescriptor>(); private List<ObjectPropertyDescriptor> children = new ArrayList<ObjectPropertyDescriptor>();
public ObjectPropertyGroupDescriptor( public ObjectPropertyGroupDescriptor(
DBPPropertySource source, DBPPropertySource source,
ObjectPropertyGroupDescriptor parent, ObjectPropertyGroupDescriptor parent,
Method getter, Method getter,
PropertyGroup groupInfo, PropertyGroup groupInfo,
IPropertyFilter filter) IPropertyFilter filter)
{ {
super(source, parent, getter, groupInfo.id(), groupInfo.order()); super(source, parent, getter, groupInfo.id(), groupInfo.order());
this.groupInfo = groupInfo; this.groupInfo = groupInfo;
extractAnnotations(source, this, getGetter().getReturnType(), children, filter); extractAnnotations(source, this, getGetter().getReturnType(), children, filter);
} }
@Override @Override
public String getCategory() public String getCategory()
{ {
return groupInfo.category(); return groupInfo.category();
} }
@Override @Override
public String getDescription() public String getDescription()
{ {
return groupInfo.description(); return groupInfo.description();
} }
public Collection<ObjectPropertyDescriptor> getChildren() public Collection<ObjectPropertyDescriptor> getChildren()
{ {
return children; return children;
} }
public Object getGroupObject(Object object, DBRProgressMonitor progressMonitor) public Object getGroupObject(Object object, DBRProgressMonitor progressMonitor)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{ {
if (getParent() != null) { if (getParent() != null) {
object = getParent().getGroupObject(object, progressMonitor); object = getParent().getGroupObject(object, progressMonitor);
} }
if (isLazy(object, false)) { if (isLazy(object, false)) {
if (progressMonitor == null) { if (progressMonitor == null) {
throw new IllegalAccessException("Can't read lazy properties with null progress monitor"); throw new IllegalAccessException("Can't read lazy properties with null progress monitor");
} }
} }
if (isLazy()) { if (isLazy()) {
return getGetter().invoke(object, progressMonitor); return getGetter().invoke(object, progressMonitor);
} else { } else {
return getGetter().invoke(object); return getGetter().invoke(object);
} }
} }
} }
...@@ -74,6 +74,7 @@ import org.jkiss.dbeaver.model.preferences.DBPPropertySource; ...@@ -74,6 +74,7 @@ import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
import org.jkiss.dbeaver.model.runtime.*; import org.jkiss.dbeaver.model.runtime.*;
import org.jkiss.dbeaver.runtime.DummyRunnableContext; import org.jkiss.dbeaver.runtime.DummyRunnableContext;
import org.jkiss.dbeaver.runtime.RunnableContextDelegate; import org.jkiss.dbeaver.runtime.RunnableContextDelegate;
import org.jkiss.dbeaver.runtime.properties.ObjectPropertyDescriptor;
import org.jkiss.dbeaver.runtime.ui.DBUserInterface; import org.jkiss.dbeaver.runtime.ui.DBUserInterface;
import org.jkiss.dbeaver.ui.controls.*; import org.jkiss.dbeaver.ui.controls.*;
import org.jkiss.dbeaver.utils.GeneralUtils; import org.jkiss.dbeaver.utils.GeneralUtils;
...@@ -1295,7 +1296,7 @@ public class UIUtils { ...@@ -1295,7 +1296,7 @@ public class UIUtils {
} }
Class<?> propertyType = property.getDataType(); Class<?> propertyType = property.getDataType();
if (propertyType == null || CharSequence.class.isAssignableFrom(propertyType)) { if (propertyType == null || CharSequence.class.isAssignableFrom(propertyType)) {
if (false/*property instanceof ObjPropDe property.isMultiLine()*/) { if (property instanceof ObjectPropertyDescriptor && ((ObjectPropertyDescriptor) property).isMultiLine()) {
return new AdvancedTextCellEditor(parent); return new AdvancedTextCellEditor(parent);
} else { } else {
return new CustomTextCellEditor(parent); return new CustomTextCellEditor(parent);
......
...@@ -75,15 +75,9 @@ public class AdvancedTextCellEditor extends DialogCellEditor { ...@@ -75,15 +75,9 @@ public class AdvancedTextCellEditor extends DialogCellEditor {
} }
protected Button createButton(Composite parent) { protected Button createButton(Composite parent) {
Button result = new Button(parent, SWT.DOWN); Button result = new Button(parent, SWT.DOWN | SWT.NO_FOCUS);
//result.setText("..."); //$NON-NLS-1$ //result.setText("..."); //$NON-NLS-1$
result.setImage(DBeaverIcons.getImage(UIIcon.DOTS_BUTTON)); //$NON-NLS-1$ result.setImage(DBeaverIcons.getImage(UIIcon.DOTS_BUTTON)); //$NON-NLS-1$
result.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
super.focusGained(e);
}
});
return result; return result;
} }
...@@ -92,13 +86,22 @@ public class AdvancedTextCellEditor extends DialogCellEditor { ...@@ -92,13 +86,22 @@ public class AdvancedTextCellEditor extends DialogCellEditor {
textEditor = new Text(cell, SWT.LEFT); textEditor = new Text(cell, SWT.LEFT);
textEditor.setFont(cell.getFont()); textEditor.setFont(cell.getFont());
textEditor.setBackground(cell.getBackground()); textEditor.setBackground(cell.getBackground());
textEditor.addTraverseListener(e -> {
if (e.detail == SWT.TRAVERSE_RETURN) {
e.doit = false;
e.detail = SWT.TRAVERSE_NONE;
String newValue = textEditor.getText();
doSetValue(newValue);
focusLost();
}
});
textFocusListener = new FocusAdapter() { textFocusListener = new FocusAdapter() {
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
String newValue = textEditor.getText(); String newValue = textEditor.getText();
doSetValue(newValue);
UIUtils.asyncExec(() -> { UIUtils.asyncExec(() -> {
if (!UIUtils.hasFocus(cell)) { if (!UIUtils.hasFocus(cell)) {
doSetValue(newValue);
AdvancedTextCellEditor.this.focusLost(); AdvancedTextCellEditor.this.focusLost();
} }
}); });
...@@ -116,13 +119,14 @@ public class AdvancedTextCellEditor extends DialogCellEditor { ...@@ -116,13 +119,14 @@ public class AdvancedTextCellEditor extends DialogCellEditor {
} }
if (value != null) { if (value != null) {
textEditor.setText((String)value); textEditor.setText((String)value);
textEditor.selectAll();
} }
} }
@Override @Override
protected Object openDialogBox(Control cellEditorWindow) { protected Object openDialogBox(Control cellEditorWindow) {
textEditor.removeFocusListener(textFocusListener); textEditor.removeFocusListener(textFocusListener);
String value = EditTextDialog.editText(cellEditorWindow.getShell(), "Edit text", (String) getValue()); String value = EditTextDialog.editText(cellEditorWindow.getShell(), "Edit value", (String) getValue());
textEditor.addFocusListener(textFocusListener); textEditor.addFocusListener(textFocusListener);
return value; return value;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册