提交 7d0ff25c 编写于 作者: S serge-rider

#3292 Procedure bodies compare

上级 33e80134
......@@ -19,6 +19,7 @@ package org.jkiss.dbeaver.tools.compare;
import org.eclipse.core.runtime.IStatus;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPNamedObject;
import org.jkiss.dbeaver.model.DBPSystemObject;
......@@ -225,6 +226,7 @@ public class CompareObjectsExecutor {
break;
}
}
boolean compareScripts = compareLazyProperties && settings.isCompareScripts();
compareLazyProperties = compareLazyProperties && settings.isCompareLazyProperties();
// Load all properties
......@@ -238,8 +240,24 @@ public class CompareObjectsExecutor {
nodeProperties = new IdentityHashMap<>();
propertyValues.put(databaseObject, nodeProperties);
}
PropertyCollector propertySource = new PropertyCollector(databaseObject, compareLazyProperties);
PropertyCollector propertySource = new PropertyCollector(databaseObject, compareLazyProperties || compareScripts);
for (ObjectPropertyDescriptor prop : properties) {
if (prop.isLazy()) {
if (!compareLazyProperties) {
if (compareScripts) {
// Only DBPScriptObject methods
if (!prop.getId().equals(DBConstants.PARAM_OBJECT_DEFINITION_TEXT) && !prop.getId().equals(DBConstants.PARAM_EXTENDED_DEFINITION_TEXT)) {
continue;
}
} else {
continue;
}
}
} else {
if (prop.isHidden()) {
continue;
}
}
Object propertyValue = propertySource.getPropertyValue(monitor, databaseObject, prop);
synchronized (PROPS_LOCK) {
if (propertyValue instanceof DBPNamedObject) {
......
......@@ -33,6 +33,7 @@ class CompareObjectsPageSettings extends ActiveWizardPage<CompareObjectsWizard>
private Button skipSystemObjects;
private Button compareLazyProperties;
private Button compareOnlyStructure;
private Button compareScriptProperties;
CompareObjectsPageSettings() {
super("Compare objects");
......@@ -105,6 +106,14 @@ class CompareObjectsPageSettings extends ActiveWizardPage<CompareObjectsWizard>
settings.setCompareOnlyStructure(compareOnlyStructure.getSelection());
}
});
compareScriptProperties = UIUtils.createCheckbox(compareSettings, "Compare scripts/procedures", settings.isCompareScripts());
compareScriptProperties.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e)
{
settings.setCompareScripts(compareScriptProperties.getSelection());
}
});
}
setControl(composite);
......
......@@ -32,13 +32,11 @@ public class CompareObjectsSettings {
FILE("Save to file");
private final String title;
private OutputType(String title)
{
private OutputType(String title) {
this.title = title;
}
public String getTitle()
{
public String getTitle() {
return title;
}
}
......@@ -47,82 +45,76 @@ public class CompareObjectsSettings {
private boolean skipSystemObjects = true;
private boolean compareLazyProperties = false;
private boolean compareOnlyStructure = false;
private boolean compareScripts = false;
private boolean showOnlyDifferences = false;
private OutputType outputType = OutputType.BROWSER;
private String outputFolder = DialogUtils.getCurDialogFolder();
public CompareObjectsSettings(List<DBNDatabaseNode> nodes)
{
public CompareObjectsSettings(List<DBNDatabaseNode> nodes) {
this.nodes = nodes;
}
public List<DBNDatabaseNode> getNodes()
{
public List<DBNDatabaseNode> getNodes() {
return nodes;
}
public boolean isSkipSystemObjects()
{
public boolean isSkipSystemObjects() {
return skipSystemObjects;
}
public void setSkipSystemObjects(boolean skipSystemObjects)
{
public void setSkipSystemObjects(boolean skipSystemObjects) {
this.skipSystemObjects = skipSystemObjects;
}
public boolean isCompareLazyProperties()
{
public boolean isCompareLazyProperties() {
return compareLazyProperties;
}
public void setCompareLazyProperties(boolean compareLazyProperties)
{
public void setCompareLazyProperties(boolean compareLazyProperties) {
this.compareLazyProperties = compareLazyProperties;
}
public boolean isCompareOnlyStructure()
{
public boolean isCompareOnlyStructure() {
return compareOnlyStructure;
}
public void setCompareOnlyStructure(boolean compareOnlyStructure)
{
public void setCompareOnlyStructure(boolean compareOnlyStructure) {
this.compareOnlyStructure = compareOnlyStructure;
}
public boolean isShowOnlyDifferences()
{
public boolean isCompareScripts() {
return compareScripts;
}
public void setCompareScripts(boolean compareScripts) {
this.compareScripts = compareScripts;
}
public boolean isShowOnlyDifferences() {
return showOnlyDifferences;
}
public void setShowOnlyDifferences(boolean showOnlyDifferences)
{
public void setShowOnlyDifferences(boolean showOnlyDifferences) {
this.showOnlyDifferences = showOnlyDifferences;
}
public OutputType getOutputType()
{
public OutputType getOutputType() {
return outputType;
}
public void setOutputType(OutputType outputType)
{
public void setOutputType(OutputType outputType) {
this.outputType = outputType;
}
public String getOutputFolder()
{
public String getOutputFolder() {
return outputFolder;
}
public void setOutputFolder(String outputFolder)
{
public void setOutputFolder(String outputFolder) {
this.outputFolder = outputFolder;
}
void loadFrom(IDialogSettings dialogSettings)
{
void loadFrom(IDialogSettings dialogSettings) {
if (dialogSettings.get("skipSystem") != null) {
skipSystemObjects = dialogSettings.getBoolean("skipSystem");
}
......@@ -135,6 +127,9 @@ public class CompareObjectsSettings {
if (dialogSettings.get("showDifference") != null) {
showOnlyDifferences = dialogSettings.getBoolean("showDifference");
}
if (dialogSettings.get("compareScripts") != null) {
compareScripts = dialogSettings.getBoolean("compareScripts");
}
if (dialogSettings.get("outputType") != null) {
outputType = OutputType.valueOf(dialogSettings.get("outputType"));
}
......@@ -143,11 +138,11 @@ public class CompareObjectsSettings {
}
}
void saveTo(IDialogSettings dialogSettings)
{
void saveTo(IDialogSettings dialogSettings) {
dialogSettings.put("skipSystem", skipSystemObjects);
dialogSettings.put("compareLazy", compareLazyProperties);
dialogSettings.put("compareStructure", compareOnlyStructure);
dialogSettings.put("compareScripts", compareScripts);
dialogSettings.put("showDifference", showOnlyDifferences);
dialogSettings.put("outputType", outputType.name());
dialogSettings.put("outputFolder", outputFolder);
......
......@@ -108,7 +108,7 @@ public class CompareReportRenderer {
styles.append("table {font-family:\"Lucida Sans Unicode\", \"Lucida Grande\", Sans-Serif;font-size:12px;text-align:left;} ");
styles.append(".missing {color:red;} .differs {color:red;} ");
styles.append(".object td,th {border-top:solid 1px; border-right:solid 1px; border-color: black; white-space:nowrap;} ");
styles.append(".property td,th {border-right:solid 1px; border-color: black; white-space:pre; } ");
styles.append(".property td,th {border-top:dashed 1px; border-right:solid 1px; border-color: black; white-space:pre; } ");
styles.append(".struct {border-top:none; !important } ");
// styles.append(".object:first-child {border:none; } ");
// styles.append(".property:first-child {border:none; } ");
......@@ -152,6 +152,7 @@ public class CompareReportRenderer {
xml.startElement("tr");
xml.addAttribute("class", "object level" + line.depth);
xml.addAttribute("valign", "top");
xml.startElement("td");
xml.addText(line.structure.getNodeType());
xml.endElement();
......@@ -206,6 +207,7 @@ public class CompareReportRenderer {
}
xml.startElement("tr");
xml.addAttribute("class", "property level" + (line.depth + 1) + (differs ? " differs" : ""));
xml.addAttribute("valign", "top");
xml.startElement("td");
xml.addText(reportProperty.property.getDisplayName());
xml.endElement();
......
......@@ -46,6 +46,8 @@ public class DBConstants {
public static final String PROP_ID_MAX_LENGTH = "maxLength"; //NON-NLS-1
public static final String PROP_ID_NOT_NULL = "notNull"; //NON-NLS-1
public static final String PARAM_INIT_ON_TEST = "initOnTest"; //NON-NLS-1
public static final String PARAM_OBJECT_DEFINITION_TEXT = "objectDefinitionText"; //NON-NLS-1
public static final String PARAM_EXTENDED_DEFINITION_TEXT = "extendedDefinitionText"; //NON-NLS-1
// Internal properties prefix. This is a legacy properties marker (used to divide driver properties from provider properties)
// Left for backward compatibility. Do not use it for new provider property names
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册