Skip to content
Permalink
Browse files

Oracle UI bundle refactoring

  • Loading branch information...
serge-rider committed Aug 7, 2019
1 parent 8aefc2b commit 0305bf438edca88ab69e37987ff03a16930ee30a
Showing with 425 additions and 1,096 deletions.
  1. +1 −0 features/org.jkiss.dbeaver.db.feature/feature.xml
  2. +0 −1 features/org.jkiss.dbeaver.db.ui.feature/feature.xml
  3. +24 −3 plugins/org.jkiss.dbeaver.ext.oracle.ui/plugin.xml
  4. +1 −1 ...ui/src/org/jkiss/dbeaver/ext/oracle/ui/{configurators → config}/OracleConstraintConfigurator.java
  5. +11 −14 ...e.ui/src/org/jkiss/dbeaver/ext/oracle/ui/{configurators → config}/OracleDataTypeConfigurator.java
  6. +26 −29 ...ui/src/org/jkiss/dbeaver/ext/oracle/ui/{configurators → config}/OracleForeignKeyConfigurator.java
  7. +71 −0 ...iss.dbeaver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/config/OracleIndexConfigurator.java
  8. +55 −0 ...s.dbeaver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/config/OraclePackageConfigurator.java
  9. +47 −0 ...dbeaver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/config/OracleProcedureConfigurator.java
  10. +41 −0 ...iss.dbeaver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/config/OracleQueueConfigurator.java
  11. +6 −61 ...cle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/{configurators → config}/OracleSchemaConfigurator.java
  12. +30 −0 ....dbeaver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/config/OracleSequenceConfigurator.java
  13. +47 −0 ...aver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/config/OracleTableTriggerConfigurator.java
  14. +0 −104 ...aver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/configurators/OracleIndexConfigurator.java
  15. +0 −152 ...er.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/configurators/OraclePackageConfigurator.java
  16. +0 −109 ....ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/configurators/OracleProcedureConfigurator.java
  17. +0 −98 ...aver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/configurators/OracleQueueConfigurator.java
  18. +0 −151 ...r.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/configurators/OracleSequenceConfigurator.java
  19. +0 −89 ...t.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/configurators/OracleTableTriggerConfigurator.java
  20. +2 −10 plugins/org.jkiss.dbeaver.ext.oracle/META-INF/MANIFEST.MF
  21. +1 −0 plugins/org.jkiss.dbeaver.ext.oracle/plugin.xml
  22. +3 −40 plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleIndexManager.java
  23. +3 −29 plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OraclePackageManager.java
  24. +2 −17 ...ns/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleProcedureManager.java
  25. +16 −31 plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleQueueManager.java
  26. +9 −90 plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleSchemaManager.java
  27. +13 −38 ...ins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleSequenceManager.java
  28. +5 −26 ...org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleTableTriggerManager.java
  29. +4 −0 plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNDatabaseNode.java
  30. +7 −3 ...ss.dbeaver.ui.editors.base/src/org/jkiss/dbeaver/ui/editors/object/struct/EditForeignKeyPage.java
@@ -19,6 +19,7 @@

<plugin id="org.jkiss.dbeaver.ext.mysql" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.mssql" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.oracle" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.postgresql" download-size="0" install-size="0" version="0.0.0" unpack="false"/>

<plugin id="org.jkiss.dbeaver.ext.generic" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
@@ -19,7 +19,6 @@

<includes id="org.jkiss.dbeaver.db.feature" version="0.0.0"/>

<plugin id="org.jkiss.dbeaver.ext.oracle" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.mysql.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.db2" download-size="0" install-size="0" version="0.0.0" unpack="true"/>
<plugin id="org.jkiss.dbeaver.ext.exasol" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
@@ -218,15 +218,36 @@
icon="icons/job_log.png">
</editor>

<configurator class="org.jkiss.dbeaver.ext.oracle.ui.configurators.OracleConstraintConfigurator">
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OracleConstraintConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint"/>
</configurator>
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.configurators.OracleDataTypeConfigurator">
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OracleDataTypeConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleDataType"/>
</configurator>
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.configurators.OracleForeignKeyConfigurator">
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OracleForeignKeyConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTableForeignKey"/>
</configurator>
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OracleIndexConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTableIndex"/>
</configurator>
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OraclePackageConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OraclePackage"/>
</configurator>
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OracleProcedureConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleProcedureStandalone"/>
</configurator>
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OracleQueueConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleQueue"/>
</configurator>
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OracleSchemaConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleSchema"/>
</configurator>
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OracleSequenceConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleSequence"/>
</configurator>
<configurator class="org.jkiss.dbeaver.ext.oracle.ui.config.OracleTableTriggerConfigurator">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTableTrigger"/>
</configurator>

</extension>

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.configurators;
package org.jkiss.dbeaver.ext.oracle.ui.config;

import org.jkiss.dbeaver.ext.oracle.OracleMessages;
import org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn;
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.configurators;
package org.jkiss.dbeaver.ext.oracle.ui.config;

import org.jkiss.dbeaver.ext.oracle.model.OracleDataType;
import org.jkiss.dbeaver.model.edit.DBEObjectConfigurator;
@@ -30,20 +30,17 @@

@Override
public OracleDataType configureObject(DBRProgressMonitor monitor, Object parent, OracleDataType dataType) {
return new UITask<OracleDataType>() {
@Override
protected OracleDataType runTask() {
EntityEditPage editPage = new EntityEditPage(dataType.getDataSource(), DBSEntityType.TYPE);
if (!editPage.edit()) {
return null;
}
dataType.setName(editPage.getEntityName());
dataType.setObjectDefinitionText("TYPE " + dataType.getName() + " AS OBJECT\n" + //$NON-NLS-1$ //$NON-NLS-2$
"(\n" + //$NON-NLS-1$
")"); //$NON-NLS-1$
return dataType;
return UITask.run(() -> {
EntityEditPage editPage = new EntityEditPage(dataType.getDataSource(), DBSEntityType.TYPE);
if (!editPage.edit()) {
return null;
}
}.execute();
dataType.setName(editPage.getEntityName());
dataType.setObjectDefinitionText("TYPE " + dataType.getName() + " AS OBJECT\n" + //$NON-NLS-1$ //$NON-NLS-2$
"(\n" + //$NON-NLS-1$
")"); //$NON-NLS-1$
return dataType;
});
}

}
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.configurators;
package org.jkiss.dbeaver.ext.oracle.ui.config;

import org.jkiss.dbeaver.ext.oracle.OracleMessages;
import org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn;
@@ -34,36 +34,33 @@

@Override
public OracleTableForeignKey configureObject(DBRProgressMonitor monitor, Object table, OracleTableForeignKey foreignKey) {
return new UITask<OracleTableForeignKey>() {
@Override
protected OracleTableForeignKey runTask() {
EditForeignKeyPage editPage = new EditForeignKeyPage(
OracleMessages.edit_oracle_foreign_key_manager_dialog_title,
foreignKey,
new DBSForeignKeyModifyRule[]{
DBSForeignKeyModifyRule.NO_ACTION,
DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT,
DBSForeignKeyModifyRule.SET_NULL,
DBSForeignKeyModifyRule.SET_DEFAULT});
editPage.setSupportsCustomName(true);
if (!editPage.edit()) {
return null;
}
return UITask.run(() -> {
EditForeignKeyPage editPage = new EditForeignKeyPage(
OracleMessages.edit_oracle_foreign_key_manager_dialog_title,
foreignKey,
new DBSForeignKeyModifyRule[]{
DBSForeignKeyModifyRule.NO_ACTION,
DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT,
DBSForeignKeyModifyRule.SET_NULL,
DBSForeignKeyModifyRule.SET_DEFAULT});
editPage.setSupportsCustomName(true);
if (!editPage.edit()) {
return null;
}

foreignKey.setReferencedConstraint((OracleTableConstraint) editPage.getUniqueConstraint());
foreignKey.setName(editPage.getName());
foreignKey.setDeleteRule(editPage.getOnDeleteRule());
int colIndex = 1;
for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
foreignKey.addColumn(
new OracleTableForeignKeyColumn(
foreignKey,
(OracleTableColumn) tableColumn.getOwnColumn(),
colIndex++));
}
return foreignKey;
foreignKey.setReferencedConstraint((OracleTableConstraint) editPage.getUniqueConstraint());
foreignKey.setName(editPage.getName());
foreignKey.setDeleteRule(editPage.getOnDeleteRule());
int colIndex = 1;
for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
foreignKey.addColumn(
new OracleTableForeignKeyColumn(
foreignKey,
(OracleTableColumn) tableColumn.getOwnColumn(),
colIndex++));
}
}.execute();
return foreignKey;
});
}

}
@@ -0,0 +1,71 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.config;

import org.jkiss.dbeaver.ext.oracle.OracleMessages;
import org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn;
import org.jkiss.dbeaver.ext.oracle.model.OracleTableIndex;
import org.jkiss.dbeaver.ext.oracle.model.OracleTableIndexColumn;
import org.jkiss.dbeaver.model.edit.DBEObjectConfigurator;
import org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityAttribute;
import org.jkiss.dbeaver.model.struct.rdb.DBSIndexType;
import org.jkiss.dbeaver.ui.UITask;
import org.jkiss.dbeaver.ui.editors.object.struct.EditIndexPage;
import org.jkiss.utils.CommonUtils;

import java.util.Collections;

/**
* Oracle index manager
*/
public class OracleIndexConfigurator implements DBEObjectConfigurator<OracleTableIndex> {

@Override
public OracleTableIndex configureObject(DBRProgressMonitor monitor, Object container, OracleTableIndex index) {
return UITask.run(() -> {
EditIndexPage editPage = new EditIndexPage(
OracleMessages.edit_oracle_index_manager_dialog_title,
index,
Collections.singletonList(DBSIndexType.OTHER));
if (!editPage.edit()) {
return null;
}

StringBuilder idxName = new StringBuilder(64);
idxName.append(CommonUtils.escapeIdentifier(index.getTable().getName())).append("_") //$NON-NLS-1$
.append(CommonUtils.escapeIdentifier(editPage.getSelectedAttributes().iterator().next().getName()))
.append("_IDX"); //$NON-NLS-1$
index.setName(DBObjectNameCaseTransformer.transformName(index.getDataSource(), idxName.toString()));
index.setUnique(editPage.isUnique());
index.setIndexType(editPage.getIndexType());
int colIndex = 1;
for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
index.addColumn(
new OracleTableIndexColumn(
index,
(OracleTableColumn) tableColumn,
colIndex++,
!Boolean.TRUE.equals(editPage.getAttributeProperty(tableColumn, EditIndexPage.PROP_DESC)),
null));
}
return index;
});
}

}
@@ -0,0 +1,55 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.config;

import org.jkiss.dbeaver.ext.oracle.model.OraclePackage;
import org.jkiss.dbeaver.model.edit.DBEObjectConfigurator;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityType;
import org.jkiss.dbeaver.ui.UITask;
import org.jkiss.dbeaver.ui.editors.object.struct.EntityEditPage;

/**
* OraclePackageConfigurator
*/
public class OraclePackageConfigurator implements DBEObjectConfigurator<OraclePackage> {

@Override
public OraclePackage configureObject(DBRProgressMonitor monitor, Object container, OraclePackage oraclePackage) {
return UITask.run(() -> {
EntityEditPage editPage = new EntityEditPage(oraclePackage.getDataSource(), DBSEntityType.PACKAGE);
if (!editPage.edit()) {
return null;
}
String packName = editPage.getEntityName();
oraclePackage.setName(packName);
oraclePackage.setObjectDefinitionText(
"CREATE OR REPLACE PACKAGE " + packName + "\n" +
"AS\n" +
"-- Package header\n" +
"END " + packName + ";");
oraclePackage.setExtendedDefinitionText(
"CREATE OR REPLACE PACKAGE BODY " + packName + "\n" +
"AS\n" +
"-- Package body\n" +
"END " + packName + ";");
return oraclePackage;
});
}

}

@@ -0,0 +1,47 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.config;

import org.jkiss.dbeaver.ext.oracle.model.OracleProcedureStandalone;
import org.jkiss.dbeaver.model.edit.DBEObjectConfigurator;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.ui.UITask;
import org.jkiss.dbeaver.ui.editors.object.struct.CreateProcedurePage;

/**
* OracleProcedureConfigurator
*/
public class OracleProcedureConfigurator implements DBEObjectConfigurator<OracleProcedureStandalone> {

@Override
public OracleProcedureStandalone configureObject(DBRProgressMonitor monitor, Object container, OracleProcedureStandalone procedure) {
return new UITask<OracleProcedureStandalone>() {
@Override
protected OracleProcedureStandalone runTask() {
CreateProcedurePage editPage = new CreateProcedurePage(procedure);
if (!editPage.edit()) {
return null;
}
procedure.setName(editPage.getProcedureName());
procedure.setProcedureType(editPage.getProcedureType());

return procedure;
}
}.execute();
}

}
@@ -0,0 +1,41 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.config;

import org.jkiss.dbeaver.ext.oracle.model.OracleQueue;
import org.jkiss.dbeaver.model.edit.DBEObjectConfigurator;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityType;
import org.jkiss.dbeaver.ui.UITask;
import org.jkiss.dbeaver.ui.editors.object.struct.EntityEditPage;

public class OracleQueueConfigurator implements DBEObjectConfigurator<OracleQueue> {

@Override
public OracleQueue configureObject(DBRProgressMonitor monitor, Object container, OracleQueue queue) {
return UITask.run(() -> {
EntityEditPage page = new EntityEditPage(queue.getDataSource(), DBSEntityType.SEQUENCE);
if (!page.edit()) {
return null;
}

queue.setName(page.getEntityName());
return queue;
});
}

}

0 comments on commit 0305bf4

Please sign in to comment.
You can’t perform that action at this time.