no message
This commit is contained in:
@@ -80,6 +80,12 @@ public class SapforPackagesComparisonForm {
|
|||||||
lObjectName.setText("?");
|
lObjectName.setText("?");
|
||||||
lObjectName.setToolTipText("Объект не назначен.");
|
lObjectName.setToolTipText("Объект не назначен.");
|
||||||
UI.Clear(treePanel);
|
UI.Clear(treePanel);
|
||||||
|
if (isMaster()){
|
||||||
|
UI.getMainWindow().getTestingWindow().ShowNoSapforPackageVersionEtalon();
|
||||||
|
}else {
|
||||||
|
UI.getMainWindow().getTestingWindow().ShowNoSapforPackageVersion();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
protected void showObject() {
|
protected void showObject() {
|
||||||
lObjectName.setText(object.getPK().toString() + (isMaster() ? "(эталон)" : ""));
|
lObjectName.setText(object.getPK().toString() + (isMaster() ? "(эталон)" : ""));
|
||||||
|
|||||||
@@ -1,13 +1,59 @@
|
|||||||
package Visual_DVM_2021.UI.Main;
|
package Visual_DVM_2021.UI.Main;
|
||||||
import Common.Current;
|
import Common.Current;
|
||||||
|
import Common.Global;
|
||||||
|
import Common.Utils.Utils;
|
||||||
|
import GlobalData.Settings.SettingName;
|
||||||
|
import ProjectData.Files.ProjectFile;
|
||||||
import SapforTestingSystem.Json.SapforVersion_json;
|
import SapforTestingSystem.Json.SapforVersion_json;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.util.Vector;
|
||||||
public class SapforVersionsComparisonForm extends ComparisonForm<SapforVersion_json> {
|
public class SapforVersionsComparisonForm extends ComparisonForm<SapforVersion_json> {
|
||||||
|
//почти полный клон VersionsComparsionForm. В будущем нужен рефакторинг. Наверное.
|
||||||
Current current;
|
Current current;
|
||||||
|
private final JComboBox<ProjectFile> cbFile;
|
||||||
|
protected ProjectFile file = null;
|
||||||
|
private SapforVersionsComparisonForm getMaster() {
|
||||||
|
return (SapforVersionsComparisonForm) master;
|
||||||
|
}
|
||||||
|
private SapforVersionsComparisonForm getSlave() {
|
||||||
|
return (SapforVersionsComparisonForm) slave;
|
||||||
|
}
|
||||||
public SapforVersionsComparisonForm(SapforVersionsComparisonForm slave_in, Current current_in) {
|
public SapforVersionsComparisonForm(SapforVersionsComparisonForm slave_in, Current current_in) {
|
||||||
super(SapforVersion_json.class, slave_in);
|
super(SapforVersion_json.class, slave_in);
|
||||||
current = current_in;
|
current = current_in;
|
||||||
bApplyObject.setVisible(false);
|
bApplyObject.setVisible(false);
|
||||||
bClose.setVisible(false);
|
bClose.setVisible(false);
|
||||||
|
cbFile = new JComboBox<>();
|
||||||
|
tools.add(cbFile, 3);
|
||||||
|
//--
|
||||||
|
cbFile.addActionListener(e -> {
|
||||||
|
ProjectFile File1 = null;
|
||||||
|
ProjectFile File2 = null;
|
||||||
|
ClearText();
|
||||||
|
file = (cbFile.getSelectedItem() instanceof ProjectFile) ?
|
||||||
|
((ProjectFile) cbFile.getSelectedItem()) : null;
|
||||||
|
if (file != null) {
|
||||||
|
if (isMaster()) {
|
||||||
|
getSlave().selectSameFile(file);
|
||||||
|
} else {
|
||||||
|
File1 = getMaster().file;
|
||||||
|
File2 = file;
|
||||||
|
//---
|
||||||
|
if ((File1 != null) && (File2 != null)) {
|
||||||
|
boolean ExtensionsOn = Global.db.settings.get(SettingName.ExtensionsOn).toBoolean();
|
||||||
|
String name1 = ExtensionsOn ? File1.file.getName() : Utils.getFileNameWithoutExtension(File1.file);
|
||||||
|
String name2 = ExtensionsOn ? File2.file.getName() : Utils.getFileNameWithoutExtension(File2.file);
|
||||||
|
System.out.println("name1=" + Utils.Brackets(name1) + "name2=" + Utils.Brackets(name2));
|
||||||
|
if (Global.db.settings.get(SettingName.ComparsionDiffMergeOn).toBoolean()) {
|
||||||
|
if (name1.equalsIgnoreCase(name2))
|
||||||
|
master.DoComparePass(true);
|
||||||
|
} else
|
||||||
|
master.DoShowPass(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected Current getCurrentObjectName() {
|
protected Current getCurrentObjectName() {
|
||||||
@@ -15,11 +61,44 @@ public class SapforVersionsComparisonForm extends ComparisonForm<SapforVersion_j
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected String getText() {
|
protected String getText() {
|
||||||
return current.getDescription();
|
return Utils.ReadAllText(file.file);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isReady() {
|
||||||
|
return super.isReady() && file != null;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void showObject() {
|
protected void showObject() {
|
||||||
lObjectName.setText(object.toString());
|
lObjectName.setText(object.toString());
|
||||||
lObjectName.setToolTipText(object.toString());
|
lObjectName.setToolTipText(object.toString());
|
||||||
|
cbFile.removeAllItems();
|
||||||
|
Vector<ProjectFile> files = object.files;
|
||||||
|
for (ProjectFile file : files)
|
||||||
|
cbFile.addItem(file);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void removeObject() {
|
||||||
|
cbFile.removeAllItems();
|
||||||
|
file = null;
|
||||||
|
}
|
||||||
|
public void selectSameFile(ProjectFile file_in) {
|
||||||
|
file = null;
|
||||||
|
cbFile.setSelectedIndex(-1);
|
||||||
|
for (int i = 0; i < cbFile.getItemCount(); ++i) {
|
||||||
|
ProjectFile projectFile = cbFile.getItemAt(i);
|
||||||
|
if (Global.db.settings.get(SettingName.ExtensionsOn).toBoolean()) {
|
||||||
|
//если учитываем расширения, ищем полное совпадение
|
||||||
|
if (projectFile.file.getName().equals(file_in.file.getName())) {
|
||||||
|
cbFile.setSelectedIndex(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Utils.getNameWithoutExtension(projectFile.file.getName()).equals(
|
||||||
|
Utils.getNameWithoutExtension(file_in.file.getName()))) {
|
||||||
|
cbFile.setSelectedIndex(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user