Browse Source

Pull request #6261: BI-95654 拷贝数据连接时复制了identity

Merge in DESIGN/design from ~XIQIU/design:release/10.0 to release/10.0

* commit '57deff1ff4f635db6ce2f81cd9cc67b7a3bc3fdb':
  BI-95654   拷贝数据连接时复制了identity
zheng-1641779399395
Xiqiu 3 years ago
parent
commit
4133df91d0
  1. 18
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

18
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -9,6 +9,7 @@ import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.i18n.Toolkit;
import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils;
@ -18,13 +19,14 @@ import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import javax.swing.SwingUtilities;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/**
* Connection List Pane.
@ -159,4 +161,18 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
connectionConfig.addConnection(nameObject.getName(), (Connection) nameObject.getObject());
}
}
@Override
public void onCopyItem() {
super.onCopyItem();
ListModelElement selectedValue = getSelectedValue();
// identity 需要重置
if (selectedValue != null && selectedValue.wrapper != null) {
Object temp = ((NameObject) selectedValue.wrapper).getObject();
if (temp instanceof JDBCDatabaseConnection) {
JDBCDatabaseConnection object = (JDBCDatabaseConnection) temp;
object.setIdentity(UUID.randomUUID().toString());
}
}
}
}

Loading…
Cancel
Save