2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes;
|
2023-09-17 22:13:42 +03:00
|
|
|
import Common.UI.Menus_2023.PassMenuItem;
|
|
|
|
|
import Common.UI.UI;
|
|
|
|
|
import ProjectData.Project.db_project_info;
|
2023-11-19 02:12:44 +03:00
|
|
|
import Repository.Component.Sapfor.TransformationPermission;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
public class Transformation extends CurrentProjectPass {
|
|
|
|
|
protected TransformationPermission getPermission() {
|
|
|
|
|
return TransformationPermission.All;
|
|
|
|
|
}
|
|
|
|
|
//todo - возможно сделать все же интерфейс для преобразований. чтобы наконец обобщить сапфоровские и несапфоровские? хз
|
|
|
|
|
@Override
|
|
|
|
|
protected void performPreparation() throws Exception {
|
|
|
|
|
db_project_info.ResetNewVersions();
|
|
|
|
|
target.createEmptyVersion(getVersionLetter(), getVersionDescription());
|
|
|
|
|
}
|
|
|
|
|
protected String getVersionDescription() {
|
|
|
|
|
return getDescription();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
return "/icons/Transformations/" + code().toString() + ".png";
|
|
|
|
|
}
|
|
|
|
|
protected String getVersionLetter() {
|
|
|
|
|
return "v";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean hasStats() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void FocusResult() {
|
|
|
|
|
UI.getMainWindow().getProjectWindow().FocusVersions();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void performDone() throws Exception {
|
|
|
|
|
//миграция типов файлов.
|
|
|
|
|
//это несапфоровские дела.тут копируем хедеры сами.
|
2023-11-26 16:11:17 +03:00
|
|
|
target.migrateFilesSettings(target.last_version, true, false);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void performFail() throws Exception {
|
|
|
|
|
super.performFail();
|
|
|
|
|
target.undoLastTransformation();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public JMenuItem createMenuItem() {
|
|
|
|
|
if (menuItem == null)
|
|
|
|
|
menuItem = new PassMenuItem(this);
|
|
|
|
|
return menuItem;
|
|
|
|
|
}
|
|
|
|
|
}
|