提交 2f4cbb59 编写于 作者: S Serge Rider

ERD object collector fix (include dnd views)


Former-commit-id: 57ebce3e
上级 c405c272
......@@ -66,7 +66,7 @@ public class ERDHandlerPaste extends AbstractHandler {
if (editor != null && !editor.isReadOnly()) {
final Collection<DBPNamedObject> objects = DatabaseObjectTransfer.getInstance().getObject();
if (!CommonUtils.isEmpty(objects)) {
final List<ERDEntity> erdEntities = DiagramObjectCollector.generateEntityList(editor.getDiagram(), objects);
final List<ERDEntity> erdEntities = DiagramObjectCollector.generateEntityList(editor.getDiagram(), objects, true);
if (!CommonUtils.isEmpty(erdEntities)) {
Command command = editor.getDiagramPart().createEntityAddCommand(erdEntities, new Point(10, 10));
editor.getCommandStack().execute(command);
......
......@@ -63,7 +63,8 @@ public class NodeDropTargetListener extends AbstractTransferDropTargetListener {
return DiagramObjectCollector.generateEntityList(
((DiagramPart) getViewer().getRootEditPart().getContents()).getDiagram(),
objects);
objects,
true);
}
@Override
......
......@@ -40,6 +40,7 @@ public class DiagramObjectCollector {
private final EntityDiagram diagram;
private final List<ERDEntity> erdEntities = new ArrayList<>();
private boolean showViews;
public DiagramObjectCollector(EntityDiagram diagram)
{
......@@ -56,6 +57,14 @@ public class DiagramObjectCollector {
return tables;
}
public boolean isShowViews() {
return showViews;
}
public void setShowViews(boolean showViews) {
this.showViews = showViews;
}
private static void collectTables(
DBRProgressMonitor monitor,
Collection<? extends DBSObject> roots,
......@@ -115,7 +124,6 @@ public class DiagramObjectCollector {
Collection<? extends DBSObject> roots)
throws DBException
{
boolean showViews = ERDActivator.getDefault().getPreferenceStore().getBoolean(ERDConstants.PREF_DIAGRAM_SHOW_VIEWS);
Collection<DBSEntity> tables = collectTables(monitor, roots);
for (DBSEntity table : tables) {
if (DBUtils.isHiddenObject(table)) {
......@@ -161,7 +169,7 @@ public class DiagramObjectCollector {
return erdEntities;
}
public static List<ERDEntity> generateEntityList(final EntityDiagram diagram, Collection<DBPNamedObject> objects)
public static List<ERDEntity> generateEntityList(final EntityDiagram diagram, Collection<DBPNamedObject> objects, boolean showViews)
{
final List<DBSObject> roots = new ArrayList<>();
for (DBPNamedObject object : objects) {
......@@ -175,6 +183,9 @@ public class DiagramObjectCollector {
try {
UIUtils.runInProgressService(monitor -> {
DiagramObjectCollector collector = new DiagramObjectCollector(diagram);
collector.setShowViews(showViews);
//boolean showViews = ERDActivator.getDefault().getPreferenceStore().getBoolean(ERDConstants.PREF_DIAGRAM_SHOW_VIEWS);
try {
collector.generateDiagramObjects(monitor, roots);
} catch (DBException e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册