no message
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package _VisualDVM;
|
||||
import Common.Utils.Vector_;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
|
||||
import java.util.Vector;
|
||||
public class Constants {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package _VisualDVM;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Mode;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Utils.Loggable;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.GlobalData.Settings.DBSetting;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.GlobalData.Compiler;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class CompilersMenuBar extends DataMenuBar {
|
||||
public CompilersMenuBar() {
|
||||
super("компиляторы",
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package _VisualDVM.GlobalData.Compiler.UI;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.TextField.StyledTextField;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import Common.Visual.Windows.Dialog.VDirectoryChooser;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Compiler.CompilerType;
|
||||
import _VisualDVM.GlobalData.Machine.MachineType;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.GlobalData.DVMParameter;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class DVMParametersMenuBar extends DataMenuBar {
|
||||
public DVMParametersMenuBar() {
|
||||
super("параметры",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.GlobalData.EnvironmentValue;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class EnvironmentValuesMenuBar extends DataMenuBar {
|
||||
public EnvironmentValuesMenuBar() {
|
||||
super("переменные окружения", PassCode.AddEnvironmentValue,
|
||||
|
||||
@@ -26,7 +26,7 @@ import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTasksDBTable;
|
||||
import _VisualDVM.GlobalData.Tasks.RunTask.RunTasksDBTable;
|
||||
import _VisualDVM.GlobalData.User.UsersDBTable;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.GlobalData.Machine;
|
||||
import Common.Visual.Controls.MenuBarButton;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.GlobalData.Makefile;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class MakefilesMenuBar extends DataMenuBar {
|
||||
public MakefilesMenuBar() {
|
||||
super("мейкфайлы",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.GlobalData.Module;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class ModulesMenuBar extends DataMenuBar {
|
||||
public ModulesMenuBar() {
|
||||
super("языковые модули", PassCode.EditModule);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package _VisualDVM.GlobalData.Module.UI;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.Controls.StyledTextComboBox;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Global;
|
||||
@@ -9,7 +8,7 @@ import _VisualDVM.GlobalData.Makefile.Makefile;
|
||||
import _VisualDVM.GlobalData.Module.Module;
|
||||
import _VisualDVM.GlobalData.Module.ModuleAnchestor;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package _VisualDVM.GlobalData.RemoteFile.UI;
|
||||
import Common.Current_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.Windows.Dialog.Dialog;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
import Visual_DVM_2021.Passes.SSH.ConnectionPass;
|
||||
import _VisualDVM.Passes.SSH.ConnectionPass;
|
||||
import com.jcraft.jsch.ChannelSftp.LsEntry;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.GlobalData.RunConfiguration;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import javax.swing.*;
|
||||
public class RunConfigurationsMenuBar extends DataMenuBar {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.GlobalData.Settings;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.Utils_;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import _VisualDVM.Visual.Menus.StableMenuItem;
|
||||
|
||||
@@ -6,7 +6,7 @@ import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Menus.TableMenu;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package _VisualDVM.GlobalData.Tasks.Passes;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Tasks.Supervisor.TaskSupervisor;
|
||||
import Visual_DVM_2021.Passes.ProcessPass;
|
||||
import _VisualDVM.Passes.ProcessPass;
|
||||
public abstract class TaskLocalPass<S extends TaskSupervisor> extends ProcessPass {
|
||||
public S supervisor; //инициализация идет в конструкторе потомка.
|
||||
public TaskLocalPass(Class<S> s_class) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package _VisualDVM.GlobalData.Tasks.RunTask;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Menus.TableMenu;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
|
||||
@@ -5,7 +5,7 @@ import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
import _VisualDVM.GlobalData.Tasks.Supervisor.TaskSupervisor;
|
||||
import _VisualDVM.GlobalData.Tasks.Task;
|
||||
import _VisualDVM.GlobalData.Tasks.TaskState;
|
||||
import Visual_DVM_2021.Passes.SSH.ConnectionPass;
|
||||
import _VisualDVM.Passes.SSH.ConnectionPass;
|
||||
public abstract class RemoteTaskSupervisor<T extends Task> extends TaskSupervisor<T, ConnectionPass> {
|
||||
protected RemoteFile getRemoteProjectsPath() {
|
||||
return new RemoteFile(pass.user.getRemoteProjectsPath(), true);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.GlobalData.User;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class UsersMenuBar extends DataMenuBar {
|
||||
public UsersMenuBar() {
|
||||
super("пользователи", PassCode.AddUser,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package _VisualDVM;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Visual.Menus.StableMenuItem;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM;
|
||||
import Common.Utils.Vector_;
|
||||
import MainModule_.MainModule_;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Visual.Windows.PassForm;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
@@ -47,6 +47,10 @@ public class MainModule extends MainModule_<GlobalDatabase> {
|
||||
public Class getPassCodesEnum() {
|
||||
return PassCode.class;
|
||||
}
|
||||
@Override
|
||||
public String getAllPassesClassPrefix() {
|
||||
return "_VisualDVM.Passes.All.";
|
||||
}
|
||||
//--
|
||||
public boolean HasProject() {
|
||||
return get(Current.Project) != null;
|
||||
|
||||
14
src/_VisualDVM/Passes/All/AbortDVMPackage.java
Normal file
14
src/_VisualDVM/Passes/All/AbortDVMPackage.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Passes.Testing.AbortTestingPackage;
|
||||
public class AbortDVMPackage extends AbortTestingPackage {
|
||||
@Override
|
||||
public Current currentName() {
|
||||
return Current.DVMPackage;
|
||||
}
|
||||
@Override
|
||||
public int getAbortType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
13
src/_VisualDVM/Passes/All/AbortSapforPackage.java
Normal file
13
src/_VisualDVM/Passes/All/AbortSapforPackage.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Passes.Testing.AbortTestingPackage;
|
||||
public class AbortSapforPackage extends AbortTestingPackage {
|
||||
@Override
|
||||
public Current currentName() {
|
||||
return Current.SapforPackage;
|
||||
}
|
||||
@Override
|
||||
public int getAbortType() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
13
src/_VisualDVM/Passes/All/ActualizeDVMPackages.java
Normal file
13
src/_VisualDVM/Passes/All/ActualizeDVMPackages.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
import _VisualDVM.Passes.Testing.ActualizeTestingPackages;
|
||||
public class ActualizeDVMPackages extends ActualizeTestingPackages<DVMPackage> {
|
||||
public ActualizeDVMPackages() {
|
||||
super(DVMPackage.class);
|
||||
}
|
||||
@Override
|
||||
protected ServerCode getCheckCode() {
|
||||
return ServerCode.UpdateActiveDVMPackages;
|
||||
}
|
||||
}
|
||||
16
src/_VisualDVM/Passes/All/ActualizePackages.java
Normal file
16
src/_VisualDVM/Passes/All/ActualizePackages.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
import _VisualDVM.Global;
|
||||
public class ActualizePackages extends Pass {
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Global.mainModule.getPass(PassCode.ActualizeDVMPackages).Do();
|
||||
Global.mainModule.getPass(PassCode.ActualizeSapforPackages).Do();
|
||||
Global.mainModule.getPass(PassCode.ActualizeServerSapfors).Do();
|
||||
}
|
||||
}
|
||||
13
src/_VisualDVM/Passes/All/ActualizeSapforPackages.java
Normal file
13
src/_VisualDVM/Passes/All/ActualizeSapforPackages.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import _VisualDVM.Passes.Testing.ActualizeTestingPackages;
|
||||
public class ActualizeSapforPackages extends ActualizeTestingPackages<SapforPackage> {
|
||||
public ActualizeSapforPackages() {
|
||||
super(SapforPackage.class);
|
||||
}
|
||||
@Override
|
||||
protected ServerCode getCheckCode() {
|
||||
return ServerCode.UpdateActiveSapforPackages;
|
||||
}
|
||||
}
|
||||
14
src/_VisualDVM/Passes/All/ActualizeServerSapfors.java
Normal file
14
src/_VisualDVM/Passes/All/ActualizeServerSapfors.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
public class ActualizeServerSapfors extends Pass {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return Global.testingServer.db.hasActiveSapfors();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Global.mainModule.getPass(PassCode.SynchronizeTests).Do();
|
||||
}
|
||||
}
|
||||
94
src/_VisualDVM/Passes/All/AddBugReport.java
Normal file
94
src/_VisualDVM/Passes/All/AddBugReport.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Database.Database;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Repository.BugReport.BugReportInterface;
|
||||
import _VisualDVM.Repository.BugReport.BugReportState;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import Common.Passes.AddObjectPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class AddBugReport extends AddObjectPass<BugReport> {
|
||||
public AddBugReport() {
|
||||
super(BugReport.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.componentsServer.db;
|
||||
}
|
||||
@Override
|
||||
public boolean canStart(Object... args) throws Exception {
|
||||
if (Global.mainModule.getAccount().role.equals(AccountRole.Undefined)) {
|
||||
Log.Writeln_("Для создания отчёта требуется регистрация");
|
||||
return false;
|
||||
}
|
||||
if (Global.mainModule.HasProject()) {
|
||||
String version = Global.mainModule.getProject().Home.getAbsolutePath().substring(Global.mainModule.getRoot().Home.getParent().length());
|
||||
if (version.toCharArray()[0] == '\\') version = version.substring(1);
|
||||
target = new BugReport(Global.mainModule.getAccount().name, Global.mainModule.getAccount().email,
|
||||
"Черновик отчёта об ошибке.\nЗаполните описание ошибочной ситуации, и нажмите 'Опубликовать'", version);
|
||||
return true;
|
||||
} else {
|
||||
if (UI_.Warning("Создать отчёт об ошибке без прикрепления проекта.")) {
|
||||
target = new BugReport();
|
||||
target.genName();
|
||||
target.sender_name = Global.mainModule.getAccount().name;
|
||||
target.sender_address = Global.mainModule.getAccount().email;
|
||||
target.project_version = "";
|
||||
target.visualiser_version = Global.visualiser.version;
|
||||
target.sapfor_version = Global.Components.get(ComponentType.Sapfor_F).version;
|
||||
target.sapfor_settings =(Global.mainModule.getDb()).settings.getSapforSettingsText();
|
||||
target.percentage = 0;
|
||||
target.description = "Черновик отчёта об ошибке.\nЗаполните описание ошибочной ситуации, и нажмите 'Опубликовать'";
|
||||
target.date = new Date().getTime();
|
||||
target.change_date = new Date().getTime();
|
||||
target.state = BugReportState.draft;
|
||||
target.owner = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
Global.mainModule.getSapfor().ResetAllAnalyses();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
super.body();
|
||||
if (!target.project_version.isEmpty()) {
|
||||
Global.mainModule.getRoot().cleanDepAndGCOVR(); //удаление депов и гкова
|
||||
//логи во вложения.
|
||||
File attachementsDir = Global.mainModule.getProject().getAttachmentsDirectory();
|
||||
Vector<File> logs = new Vector<>();
|
||||
logs.add(Utils_.MainLog.getLogFile());
|
||||
logs.add(Paths.get(Global.ComponentsDirectory.getAbsolutePath(), "Sapfor_log.txt").toFile());
|
||||
logs.add(Paths.get(Global.ComponentsDirectory.getAbsolutePath(), "Server_log.txt").toFile());
|
||||
logs.add(Global.Components.get(ComponentType.Visualizer_2).getLogFile());
|
||||
for (File file : logs) {
|
||||
if (file.exists())
|
||||
Files.copy(file.toPath(), Paths.get(attachementsDir.getAbsolutePath(), file.getName()), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
//запаковка рута
|
||||
Global.mainModule.getPass(PassCode.ZipFolderPass).Do(Global.mainModule.getRoot().Home.getAbsolutePath(), BugReportInterface.getArchiveFile(target).getAbsolutePath());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
double size = Utils_.getFileSizeMegaBytes(BugReportInterface.getArchiveFile(target));
|
||||
if (size > 100) {
|
||||
Log.Writeln_("Размер запакованного вложения " + size + " Мб превышает 100 Мб");
|
||||
return false;
|
||||
}
|
||||
return super.validate();
|
||||
}
|
||||
}
|
||||
14
src/_VisualDVM/Passes/All/AddCompiler.java
Normal file
14
src/_VisualDVM/Passes/All/AddCompiler.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import Common.Passes.AddObjectPass;
|
||||
public class AddCompiler extends AddObjectPass<Compiler> {
|
||||
public AddCompiler() {
|
||||
super(Compiler.class);
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
}
|
||||
14
src/_VisualDVM/Passes/All/AddDVMParameter.java
Normal file
14
src/_VisualDVM/Passes/All/AddDVMParameter.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.GlobalData.DVMParameter.DVMParameter;
|
||||
import _VisualDVM.GlobalData.RunConfiguration.RunConfiguration;
|
||||
import Common.Passes.AddObjectPass;
|
||||
public class AddDVMParameter extends AddObjectPass<DVMParameter> {
|
||||
public AddDVMParameter() {
|
||||
super(DVMParameter.class);
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return RunConfiguration.class;
|
||||
}
|
||||
}
|
||||
38
src/_VisualDVM/Passes/All/AddDVMParameterForTesting.java
Normal file
38
src/_VisualDVM/Passes/All/AddDVMParameterForTesting.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.DVMParameter.DVMParameter;
|
||||
import _VisualDVM.GlobalData.DVMParameter.UI.DVMParameterFields;
|
||||
import Common.Passes.Pass;
|
||||
public class AddDVMParameterForTesting extends Pass<String> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
DBObjectDialog<DVMParameter, DVMParameterFields> dialog =
|
||||
new DBObjectDialog<DVMParameter, DVMParameterFields>(DVMParameterFields.class) {
|
||||
@Override
|
||||
public void fillFields() {
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
String name = (String) fields.cbName.getSelectedItem();
|
||||
String value = fields.tfValue.getText();
|
||||
if (name.isEmpty())
|
||||
Log.Writeln("Имя параметра DVM системы не может быть пустым.");
|
||||
if (Utils.isLinuxSystemCommand(name))
|
||||
Log.Writeln(Utils_.DQuotes(name) + " является системной командой Linux");
|
||||
if (Utils.isLinuxSystemCommand(value))
|
||||
Log.Writeln(Utils_.DQuotes(value) + " является системной командой Linux");
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
target = fields.cbName.getSelectedItem() +"="+fields.tfValue.getText();
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 200;
|
||||
}
|
||||
};
|
||||
return dialog.ShowDialog("Добавление параметра DVM системы", new DVMParameter());
|
||||
}
|
||||
}
|
||||
8
src/_VisualDVM/Passes/All/AddEnvironmentValue.java
Normal file
8
src/_VisualDVM/Passes/All/AddEnvironmentValue.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Passes.AddObjectPass;
|
||||
import _VisualDVM.GlobalData.EnvironmentValue.EnvironmentValue;
|
||||
public class AddEnvironmentValue extends AddObjectPass<EnvironmentValue> {
|
||||
public AddEnvironmentValue() {
|
||||
super(EnvironmentValue.class);
|
||||
}
|
||||
}
|
||||
74
src/_VisualDVM/Passes/All/AddFile.java
Normal file
74
src/_VisualDVM/Passes/All/AddFile.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.Text.FileNameForm;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.Files.FileType;
|
||||
import _VisualDVM.Passes.Project.ChangeFilePass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class AddFile extends ChangeFilePass<DBProjectFile> {
|
||||
Mode mode;
|
||||
File src;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
resetArgs();
|
||||
mode = Mode.Dialog;
|
||||
src = null;
|
||||
if (args.length > 0) {
|
||||
src = (File) args[0];
|
||||
mode = Mode.Import;
|
||||
fileName = src.getName();
|
||||
if (Utils_.ContainsCyrillic(fileName)) {
|
||||
Log.Writeln_("Имя файла " + Utils_.Brackets(fileName) + " содержит кириллицу.");
|
||||
return false;
|
||||
}
|
||||
if (Utils_.ContainsForbiddenName(fileName)) {
|
||||
Log.Writeln_("Имя файла " + Utils_.Brackets(fileName)
|
||||
+ " содержит запрещенные символы." +
|
||||
"\n" + Utils_.printAllForbiddenCharacters());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
(ff = new FileNameForm()).ShowDialog("Введите имя создаваемого файла");
|
||||
fileName = ff.Result;
|
||||
//тут имена фильтруются уже на этапе формы.
|
||||
}
|
||||
if (fileName != null) {
|
||||
//->
|
||||
parent_node = Global.mainModule.getProjectCurrentParentNode();
|
||||
target_dir = (File) parent_node.getUserObject();
|
||||
//->
|
||||
dst = Paths.get(target_dir.getAbsolutePath(), fileName).toFile();
|
||||
if (dst.exists()) {
|
||||
Log.Writeln_("Файл с именем " + Utils_.Brackets(fileName) + " уже существует");
|
||||
return false;
|
||||
}
|
||||
target = new DBProjectFile(dst, project);
|
||||
if (target.fileType.equals(FileType.forbidden)) {
|
||||
Log.Writeln_("Расширение " + Utils_.Brackets(Utils_.getExtension(dst)) + " недопустимо");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
if (mode == Mode.Dialog) Utils.WriteToFile(target.file, "");
|
||||
else FileUtils.copyFile(src, dst);
|
||||
project.db.Insert(target);
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().AddNode(parent_node,
|
||||
dst_node = target.node = new DefaultMutableTreeNode(target)
|
||||
);
|
||||
}
|
||||
enum Mode {
|
||||
Dialog,
|
||||
Import
|
||||
}
|
||||
}
|
||||
54
src/_VisualDVM/Passes/All/AddMachine.java
Normal file
54
src/_VisualDVM/Passes/All/AddMachine.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
import _VisualDVM.GlobalData.Compiler.CompilerType;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Machine.MachineType;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
import Common.Passes.AddObjectPass;
|
||||
public class AddMachine extends AddObjectPass<Machine> {
|
||||
public AddMachine() {
|
||||
super(Machine.class);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (super.canStart(args)) {
|
||||
if (target.type.equals(MachineType.Local) && Global.mainModule.getDb().machines.LocalMachineExists()) {
|
||||
Log.Writeln_("Локальная машина уже добавлена.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
getDb().Insert(new Compiler(
|
||||
target,
|
||||
"gfortran",
|
||||
CompilerType.gnu,
|
||||
"gfortran",
|
||||
"--version",
|
||||
"--help"
|
||||
));
|
||||
getDb().Insert(new Compiler(
|
||||
target,
|
||||
"gcc",
|
||||
CompilerType.gnu,
|
||||
"gcc",
|
||||
"--version",
|
||||
"--help"
|
||||
));
|
||||
getDb().Insert(new Compiler(
|
||||
target,
|
||||
"g++",
|
||||
CompilerType.gnu,
|
||||
"g++",
|
||||
"--version",
|
||||
"--help"
|
||||
));
|
||||
if (target.type.equals(MachineType.Local))
|
||||
getDb().Insert(new User(target, "этот пользователь", ""));
|
||||
}
|
||||
}
|
||||
24
src/_VisualDVM/Passes/All/AddMakefile.java
Normal file
24
src/_VisualDVM/Passes/All/AddMakefile.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Passes.AddObjectPass;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Makefile.Makefile;
|
||||
import _VisualDVM.GlobalData.Module.Module;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
public class AddMakefile extends AddObjectPass<Makefile> {
|
||||
public AddMakefile() {
|
||||
super(Makefile.class);
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
super.body();
|
||||
//создать модули для языков.
|
||||
getDb().Insert(new Module(LanguageName.fortran, target));
|
||||
getDb().Insert(new Module(LanguageName.c, target));
|
||||
getDb().Insert(new Module(LanguageName.cpp, target));
|
||||
}
|
||||
}
|
||||
14
src/_VisualDVM/Passes/All/AddRunConfiguration.java
Normal file
14
src/_VisualDVM/Passes/All/AddRunConfiguration.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.RunConfiguration.RunConfiguration;
|
||||
import Common.Passes.AddObjectPass;
|
||||
public class AddRunConfiguration extends AddObjectPass<RunConfiguration> {
|
||||
public AddRunConfiguration() {
|
||||
super(RunConfiguration.class);
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
}
|
||||
39
src/_VisualDVM/Passes/All/AddSubscriber.java
Normal file
39
src/_VisualDVM/Passes/All/AddSubscriber.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class AddSubscriber extends ComponentsRepositoryPass<Subscriber> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/RedAdd.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = new Subscriber();
|
||||
return fillObjectFields();
|
||||
}
|
||||
protected boolean fillObjectFields() throws Exception {
|
||||
return server.db.subscribers.ShowAddObjectDialog(target);
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, "", target));
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
Global.mainModule.getPass(PassCode.SynchronizeBugReports).Do();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
super.showDone();
|
||||
server.db.subscribers.ui_.Show(target.getPK());
|
||||
}
|
||||
}
|
||||
34
src/_VisualDVM/Passes/All/AddUser.java
Normal file
34
src/_VisualDVM/Passes/All/AddUser.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Machine.MachineType;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
import Common.Passes.AddObjectPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class AddUser extends AddObjectPass<User> {
|
||||
public AddUser() {
|
||||
super(User.class);
|
||||
}
|
||||
@Override
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
return Machine.class;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (super.canStart(args)) {
|
||||
Machine machine = Global.mainModule.getMachine();
|
||||
if (machine.type.equals(MachineType.Local) && (machine.getUsers().size() > 0)) {
|
||||
Log.Writeln_("У локальной машины может быть только один пользователь");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
super.showDone();
|
||||
Global.mainModule.getPass(PassCode.InitialiseUser).Do();
|
||||
}
|
||||
}
|
||||
19
src/_VisualDVM/Passes/All/AppendBugReportComment.java
Normal file
19
src/_VisualDVM/Passes/All/AppendBugReportComment.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
public class AppendBugReportComment extends AppendBugReportField {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart("comment",
|
||||
UI.getMainWindow().getCallbackWindow().getBugReportCommentAdditionText());
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
UI.getMainWindow().getCallbackWindow().ClearBugReportCommentAdditionText();
|
||||
}
|
||||
@Override
|
||||
protected boolean canUpdate() {
|
||||
return Global.mainModule.getAccount().ExtendedCheckAccessRights(target, Log);
|
||||
}
|
||||
}
|
||||
14
src/_VisualDVM/Passes/All/AppendBugReportDescription.java
Normal file
14
src/_VisualDVM/Passes/All/AppendBugReportDescription.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Visual.UI;
|
||||
public class AppendBugReportDescription extends AppendBugReportField {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart("description",
|
||||
UI.getMainWindow().getCallbackWindow().getBugReportDescriptionAdditionText());
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
UI.getMainWindow().getCallbackWindow().ClearBugReportDescriptionAdditionText();
|
||||
}
|
||||
}
|
||||
94
src/_VisualDVM/Passes/All/AppendBugReportField.java
Normal file
94
src/_VisualDVM/Passes/All/AppendBugReportField.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Repository.BugReport.BugReportInterface;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.util.Date;
|
||||
public class AppendBugReportField extends ComponentsRepositoryPass<BugReport> {
|
||||
String fieldName;
|
||||
String oldValue;
|
||||
String addition;
|
||||
String newValue;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Append.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
protected boolean canUpdate() {
|
||||
return Global.mainModule.getAccount().CheckAccessRights(target.sender_address, Log);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Global.mainModule.Check(Log, Current.BugReport)) {
|
||||
target = Global.mainModule.getBugReport();
|
||||
if (!BugReportInterface.CheckNotDraft(target,Log))
|
||||
return false;
|
||||
fieldName = (String) args[0];
|
||||
addition = (String) args[1];
|
||||
if (addition.isEmpty()) {
|
||||
Log.Writeln_("Дополнение не может быть пустым.");
|
||||
return false;
|
||||
}
|
||||
return canUpdate();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.GetObjectCopyByPK, "", new Pair<>(BugReport.class, target.id)));
|
||||
target.SynchronizeFields((BugReport) response.object);
|
||||
oldValue = (String) BugReport.class.getField(fieldName).get(target);
|
||||
newValue = oldValue + "\n" + Utils_.Brackets(Utils_.print_date(
|
||||
new Date())) + " " + Global.mainModule.getAccount().name
|
||||
+ " : " + addition;
|
||||
//2. дописываем нужное поле.
|
||||
BugReport.class.getField(fieldName).set(target, newValue);
|
||||
//обновляем дату.
|
||||
target.change_date = new Date().getTime();
|
||||
server.db.Update(target);
|
||||
//3. отправляем на сервер
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.UpdateBugReportField, fieldName, target));
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
server.db.bugReports.RefreshUI();
|
||||
UI.getMainWindow().getCallbackWindow().ShowCurrentBugReport();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
String message_header = BugReportInterface.getMailTitlePrefix(target);
|
||||
String message_text = "";
|
||||
switch (fieldName) {
|
||||
default:
|
||||
return;
|
||||
case "description":
|
||||
message_header += "описание дополнено";
|
||||
message_text = target.description
|
||||
;
|
||||
break;
|
||||
case "comment":
|
||||
message_header += "комментарий дополнен";
|
||||
message_text = target.comment;
|
||||
break;
|
||||
}
|
||||
Global.mainModule.getPass(PassCode.Email).Do(
|
||||
new EmailMessage(
|
||||
message_header + " " + Utils_.Brackets(Global.mainModule.getAccount().name),
|
||||
message_text,
|
||||
BugReportInterface.getRecipients(target)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
58
src/_VisualDVM/Passes/All/ApplyBugReportSettings.java
Normal file
58
src/_VisualDVM/Passes/All/ApplyBugReportSettings.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
public class ApplyBugReportSettings extends Pass<BugReport> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Apply.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public boolean needsConfirmations() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
if (Global.mainModule.Check(Log, Current.BugReport)) {
|
||||
target = Global.mainModule.getBugReport();
|
||||
long vv = target.visualiser_version;
|
||||
if (vv < 500) {
|
||||
Log.Writeln_("Автоматическое применение настроек поддерживается только в отчётах об ошибках,\n" +
|
||||
"отправленных с версии визуализатора 500 и выше");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
String[] lines = target.sapfor_settings.split("\n");
|
||||
LinkedHashMap<SettingName, String> to_apply = new LinkedHashMap<>();
|
||||
for (int i = 1; i < lines.length; ++i) {
|
||||
SettingName settingName = SettingName.getByDescription(lines[i].substring(4, lines[i].indexOf('=')));
|
||||
String settingValue = lines[i].substring(lines[i].indexOf('=') + 1);
|
||||
if (!settingName.equals(SettingName.Undefined))
|
||||
to_apply.put(settingName, settingValue);
|
||||
}
|
||||
//сохранить текущие настройки как профиль
|
||||
// Global.db.rewriteProfileByDescription("Saved Profile");
|
||||
//--
|
||||
//само применение.
|
||||
for (SettingName settingName : to_apply.keySet())
|
||||
Global.mainModule.getPass(PassCode.UpdateSetting).Do(
|
||||
settingName,
|
||||
to_apply.get(settingName));
|
||||
//сохранить настройки бага как профиль
|
||||
// Global.db.rewriteProfileByDescription(target.id);
|
||||
}
|
||||
}
|
||||
48
src/_VisualDVM/Passes/All/ApplyCurrentFunction.java
Normal file
48
src/_VisualDVM/Passes/All/ApplyCurrentFunction.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.Text.ComboTextDialog;
|
||||
import _VisualDVM.ProjectData.SapforData.Functions.FuncInfo;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Vector;
|
||||
public class ApplyCurrentFunction extends Pass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Apply.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if ( Global.mainModule.getPass(PassCode.SPF_GetGraphFunctions).isDone()) {
|
||||
ComboTextDialog ff = new ComboTextDialog();
|
||||
Vector<String> names = new Vector<>(Global.mainModule.getProject().allFunctions.keySet());
|
||||
names.sort(Comparator.naturalOrder());
|
||||
if (ff.ShowDialog("Выберите имя текущей процедуры", names)) {
|
||||
String func_name = ff.Result;
|
||||
if (Global.mainModule.getProject().allFunctions.containsKey(func_name)) {
|
||||
FuncInfo fi = Global.mainModule.getProject().allFunctions.get(func_name);
|
||||
Global.mainModule.set(Current.Function, fi);
|
||||
return true;
|
||||
} else {
|
||||
Log.Writeln_("Проект не содержит процедуры с именем " + Utils_.Brackets(func_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
UI.getMainWindow().getProjectWindow().getFunctionsWindow().ShowCurrentFunction();
|
||||
if (SPF_GetGraphFunctionPositions.showByCurrentFunction) {
|
||||
Global.mainModule.getPass(PassCode.SPF_GetGraphFunctionPositions).Do();
|
||||
}
|
||||
}
|
||||
}
|
||||
43
src/_VisualDVM/Passes/All/ApplyProfile.java
Normal file
43
src/_VisualDVM/Passes/All/ApplyProfile.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
|
||||
import _VisualDVM.GlobalData.SapforProfileSetting.SapforProfileSetting;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.util.Vector;
|
||||
public class ApplyProfile extends Pass<SapforProfile> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Apply.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public boolean needsConfirmations() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Global.mainModule.Check(Log, Current.SapforProfile)) {
|
||||
target = (SapforProfile) Global.mainModule.get(Current.SapforProfile);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Vector<SapforProfileSetting> settings = new Vector<>();
|
||||
for (SapforProfileSetting sapforProfileSetting : Global.mainModule.getDb().sapforProfilesSettings.Data.values())
|
||||
if (sapforProfileSetting.sapforprofile_id == target.id)
|
||||
settings.add(sapforProfileSetting);
|
||||
//--
|
||||
for (SapforProfileSetting setting : settings)
|
||||
if (Global.mainModule.getDb().settings.containsKey(setting.name))
|
||||
Global.mainModule.getPass(PassCode.UpdateSetting).Do(setting.name, setting.value);
|
||||
//--
|
||||
}
|
||||
}
|
||||
53
src/_VisualDVM/Passes/All/ArchivesBackupPass.java
Normal file
53
src/_VisualDVM/Passes/All/ArchivesBackupPass.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
import _VisualDVM.Passes.SSH.ConnectionPass;
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Comparator;
|
||||
import java.util.Vector;
|
||||
public class ArchivesBackupPass extends ConnectionPass<File> {
|
||||
File src;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
machine = (Machine) args[0];
|
||||
user = (User) args[1];
|
||||
src = (File) args[2];
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
String workspace_path = Utils_.toU(Paths.get(user.connection.sftpChannel.getHome(), Global.properties.BackupWorkspace).toString());
|
||||
RemoteFile workspace = new RemoteFile(workspace_path, true);
|
||||
user.connection.MKDIR(workspace);
|
||||
RemoteFile dst = new RemoteFile(workspace.full_name, src.getName());
|
||||
user.connection.putSingleFile(src, dst);
|
||||
//-теперь, удалить старые файлы.
|
||||
Vector<ChannelSftp.LsEntry> raw_files = user.connection.sftpChannel.ls(workspace.full_name);
|
||||
Vector<RemoteFile> files = new Vector<>();
|
||||
for (ChannelSftp.LsEntry file : raw_files) {
|
||||
if (!file.getAttrs().isDir()) {
|
||||
RemoteFile rfile = new RemoteFile(workspace.full_name, file.getFilename(), false);
|
||||
rfile.updateTime = RemoteFile.convertUpdateTime(file.getAttrs().getMTime());
|
||||
files.add(rfile);
|
||||
}
|
||||
}
|
||||
//сортируем по времени обновления. по убыванию.
|
||||
files.sort(new Comparator<RemoteFile>() {
|
||||
@Override
|
||||
public int compare(RemoteFile o1, RemoteFile o2) {
|
||||
return Long.compare(o1.updateTime, o2.updateTime);
|
||||
}
|
||||
}.reversed()
|
||||
);
|
||||
for (int i = 2; i < files.size(); ++i) {
|
||||
user.connection.sftpChannel.rm(files.get(i).full_name);
|
||||
}
|
||||
//--------------
|
||||
}
|
||||
}
|
||||
40
src/_VisualDVM/Passes/All/BuildComponent.java
Normal file
40
src/_VisualDVM/Passes/All/BuildComponent.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Repository.Component.Component;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.PassException;
|
||||
import _VisualDVM.Passes.ProcessPass;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
public class BuildComponent extends ProcessPass<Component> {
|
||||
@Override
|
||||
protected PassCode necessary() {
|
||||
return PassCode.DownloadRepository;
|
||||
}
|
||||
@Override
|
||||
protected boolean resetsNecessary() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = Global.mainModule.getComponent();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
Utils.forceDeleteWithCheck(target.getAssemblyFile());
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
ShowMessage1("Сборка " + target.getComponentType().getDescription());
|
||||
PerformScript(target.getAssemblyCommand());
|
||||
if (!target.getAssemblyFile().exists())
|
||||
throw new PassException("Сборка не найдена");
|
||||
Files.copy(target.getAssemblyFile().toPath(),
|
||||
target.getNewFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
if (!target.getNewFile().exists())
|
||||
throw new PassException("Не удалось скопировать сборку для установки");
|
||||
}
|
||||
}
|
||||
69
src/_VisualDVM/Passes/All/CheckAccount.java
Normal file
69
src/_VisualDVM/Passes/All/CheckAccount.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
public class CheckAccount extends Pass<Boolean> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = false;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Registry.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
/*
|
||||
switch (Current.getAccount().email){
|
||||
case "vmk-post@yandex.ru":
|
||||
case "79854210702@ya.ru":
|
||||
Current.getAccount().role = AccountRole.Admin;
|
||||
target = true;
|
||||
break;
|
||||
case "npodderyugina@gmail.com":
|
||||
case "savol@keldysh.ru":
|
||||
case "mkocharmin@yandex.ru":
|
||||
case "juk.06@list.ru":
|
||||
Current.getAccount().role = AccountRole.Developer;
|
||||
target = true;
|
||||
break;
|
||||
case "?":
|
||||
Current.getAccount().role = AccountRole.Undefined;
|
||||
target = false;
|
||||
break;
|
||||
default:
|
||||
Current.getAccount().role =AccountRole.User;
|
||||
target = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
//временно. оффлайн проверка по почте
|
||||
|
||||
target = Global.mainModule.getAccount().email.equals("?") ?
|
||||
( Global.mainModule.getPass(PassCode.EditAccount).Do() &&
|
||||
Global.mainModule.getPass(PassCode.CheckRegistrationOnServer).Do()) :
|
||||
( Global.mainModule.getPass(PassCode.CheckRegistrationOnServer).Do());
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return target;
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
if (UI.getMainWindow() != null) {
|
||||
UI.getMainWindow().getCallbackWindow().ShowAccount();
|
||||
if (Global.mainModule.HasBugReport())
|
||||
UI.getMainWindow().getCallbackWindow().ShowCurrentBugReport();
|
||||
}
|
||||
if (Global.mainModule.getAccount().isAdmin())
|
||||
Global.mainModule.getPass(PassCode.PublishComponent).setControlsVisible(true);
|
||||
setControlsVisible(false); //если проверка успешна, кнопку больше не показывать.
|
||||
}
|
||||
}
|
||||
14
src/_VisualDVM/Passes/All/CheckRegistrationOnServer.java
Normal file
14
src/_VisualDVM/Passes/All/CheckRegistrationOnServer.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
public class CheckRegistrationOnServer extends ComponentsRepositoryPass<Subscriber> {
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.CheckSubscriberRole, "", Global.mainModule.getAccount()));
|
||||
target = (Subscriber) response.object;
|
||||
Global.mainModule.getAccount().role = target.role;
|
||||
}
|
||||
}
|
||||
22
src/_VisualDVM/Passes/All/CheckRemoteWorkspace.java
Normal file
22
src/_VisualDVM/Passes/All/CheckRemoteWorkspace.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Repository.SubscriberWorkspace.SubscriberWorkspace;
|
||||
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
public class CheckRemoteWorkspace extends ComponentsRepositoryPass<SubscriberWorkspace> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target=null;
|
||||
return Global.mainModule.getAccount().CheckRegistered(Log);
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
String email = Global.mainModule.getAccount().email;
|
||||
String machineURL = Global.mainModule.getMachine().getURL();
|
||||
String login = Global.mainModule.getUser().login;
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.CheckURLRegistered,
|
||||
email+"\n"+machineURL+"\n"+login));
|
||||
target = (SubscriberWorkspace) response.object;
|
||||
}
|
||||
}
|
||||
29
src/_VisualDVM/Passes/All/CleanAnalyses.java
Normal file
29
src/_VisualDVM/Passes/All/CleanAnalyses.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Passes.Project.CurrentProjectPass;
|
||||
public class CleanAnalyses extends CurrentProjectPass {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart(args) && (Global.mainModule.getSapfor() != null);
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Global.mainModule.getSapfor().ResetAllAnalyses();
|
||||
target.CleanAnalyses();
|
||||
target.CreateParserOptionsDirs();
|
||||
target.ClearGCOV();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
super.showDone();
|
||||
UI.getMainWindow().getProjectWindow().RefreshProjectFiles();
|
||||
UI.getMainWindow().getProjectWindow().ShowNoAnalyses();
|
||||
UI.getMainWindow().getProjectWindow().ShowProjectSapforLog();
|
||||
if (Global.mainModule.HasFile()) {
|
||||
Global.mainModule.getFile().form.ShowNoMessages();
|
||||
Global.mainModule.getFile().form.ShowNoAnalyses();
|
||||
Global.mainModule.getFile().form.ShowNoGCOVLog();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
||||
import Common.Passes.Pass;
|
||||
public class CloneCurrentDVMConfiguration extends Pass<DVMConfiguration> {
|
||||
}
|
||||
15
src/_VisualDVM/Passes/All/CloneDVMSettings.java
Normal file
15
src/_VisualDVM/Passes/All/CloneDVMSettings.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMSettings.DVMSettings;
|
||||
import _VisualDVM.Passes.Server.CloneServerObject;
|
||||
public class CloneDVMSettings extends CloneServerObject<TestingServer, DVMSettings> {
|
||||
public CloneDVMSettings() {
|
||||
super(Global.testingServer, DVMSettings.class);
|
||||
}
|
||||
@Override
|
||||
protected Current currentName() {
|
||||
return Current.DVMSettings;
|
||||
}
|
||||
}
|
||||
35
src/_VisualDVM/Passes/All/CloneSapforSettings.java
Normal file
35
src/_VisualDVM/Passes/All/CloneSapforSettings.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettings;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Server.CloneServerObject;
|
||||
//автоматической
|
||||
import java.util.Vector;
|
||||
public class CloneSapforSettings extends CloneServerObject<TestingServer, SapforSettings> {
|
||||
public CloneSapforSettings() {
|
||||
super(Global.testingServer, SapforSettings.class);
|
||||
}
|
||||
@Override
|
||||
protected Current currentName() {
|
||||
return Current.SapforSettings;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
super.ServerAction();
|
||||
Vector<PassCode> codes = src.getCodes();
|
||||
Vector<DBObject> new_commands = new Vector<>();
|
||||
for (PassCode code : codes) {
|
||||
SapforSettingsCommand command = new SapforSettingsCommand();
|
||||
command.sapforsettings_id = (int) pk;
|
||||
command.passCode = code;
|
||||
new_commands.add(command);
|
||||
}
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.PublishObjects,null, new_commands));
|
||||
}
|
||||
}
|
||||
16
src/_VisualDVM/Passes/All/CloseBugReport.java
Normal file
16
src/_VisualDVM/Passes/All/CloseBugReport.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Repository.BugReport.BugReportState;
|
||||
public class CloseBugReport extends UpdateBugReportField {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/CloseBugReport.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart("state", BugReportState.closed, "percentage", 100);
|
||||
}
|
||||
}
|
||||
45
src/_VisualDVM/Passes/All/CloseCurrentFile.java
Normal file
45
src/_VisualDVM/Passes/All/CloseCurrentFile.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.Visual.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
public class CloseCurrentFile extends Pass<DBProjectFile> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Close.png";
|
||||
}
|
||||
@Override
|
||||
public Icon getTabIcon() {
|
||||
return Utils_.getIcon("/icons/Close_18.png");
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return (target = Global.mainModule.getFile()) != null;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
//действия по закрытию. сохранение и т д.
|
||||
target.form.SaveSplitters();
|
||||
target.UpdateLastLine(target.form.getEditor().getCurrentLine());
|
||||
Global.mainModule.getPass(PassCode.Save).Do();
|
||||
UI.getSearchReplaceWindow().ClearMarkers();
|
||||
target.form = null;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Global.mainModule.DropCurrentFile();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
//отобразить отсутствие файла.
|
||||
UI.getMainWindow().getProjectWindow().ShowNoFile();
|
||||
}
|
||||
}
|
||||
53
src/_VisualDVM/Passes/All/CloseCurrentProject.java
Normal file
53
src/_VisualDVM/Passes/All/CloseCurrentProject.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import javax.swing.*;
|
||||
public class CloseCurrentProject extends Pass<db_project_info> {
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Close.png";
|
||||
}
|
||||
@Override
|
||||
public Icon getTabIcon() {
|
||||
return Utils_.getIcon("/icons/Close_18.png");
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return (target = Global.mainModule.getProject()) != null;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentFile).Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
target.Close();
|
||||
UI.HideSearchForm();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Global.files_multiselection = false;
|
||||
//--
|
||||
Global.mainModule.getSapfor().ResetAllAnalyses();
|
||||
Global.mainModule.getSapfor().cd(Utils_.getHomeDirectory());
|
||||
Global.mainModule.DropCurrentProject();
|
||||
//-
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
if (UI.HasMainWindow()) {
|
||||
UI.getMainWindow().ShowNoProject();
|
||||
UI.getVersionsWindow().ShowNoProjectVariants();
|
||||
UI.getVersionsWindow().BlockVariants();
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/_VisualDVM/Passes/All/CloseProject.java
Normal file
23
src/_VisualDVM/Passes/All/CloseProject.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import Common.Passes.Pass;
|
||||
public class CloseProject extends Pass<db_project_info> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return (target = Global.mainModule.getProject()) != null;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
target.Close();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Global.mainModule.getSapfor().ResetAllAnalyses();
|
||||
Global.mainModule.getSapfor().cd(Utils_.getHomeDirectory());
|
||||
Global.mainModule.set(Current.Project, null);
|
||||
//-
|
||||
}
|
||||
}
|
||||
102
src/_VisualDVM/Passes/All/CombineFiles.java
Normal file
102
src/_VisualDVM/Passes/All/CombineFiles.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.Text.ComboTextDialog;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.Repository.Component.Sapfor.TransformationPermission;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Sapfor.Transformation;
|
||||
import _VisualDVM.Visual.Windows.CombineFilesDialog;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class CombineFiles extends Transformation {
|
||||
ComboTextDialog fd = null;
|
||||
protected File result = null;
|
||||
@Override
|
||||
protected PassCode necessary() {
|
||||
return PassCode.SPF_GetIncludeDependencies;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
switch (Global.transformationPermission) {
|
||||
case All:
|
||||
return super.canStart(args) && target.CheckSameStyle(Log) &&
|
||||
(fd = new CombineFilesDialog()).ShowDialog("Выберите имя итогового файла", target.files_order);
|
||||
case VariantsOnly:
|
||||
if (getPermission().equals(TransformationPermission.VariantsOnly)) {
|
||||
return super.canStart(args) && target.CheckSameStyle(Log) && (
|
||||
(fd = new CombineFilesDialog()).ShowDialog("Выберите имя итогового файла", target.files_order)
|
||||
);
|
||||
} else {
|
||||
Log.Writeln_("Разрешено только построение параллельных вариантов!");
|
||||
return false;
|
||||
}
|
||||
case None:
|
||||
Log.Writeln_("Нет разрешения на выполнение преобразований");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//правила инклудов https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vna1/index.html
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
result = Paths.get(target.last_version.Home.getAbsolutePath(),
|
||||
Utils_.isWindows() ? fd.Result : Utils_.toU(fd.Result)).toFile();
|
||||
//-----------------------
|
||||
//получить список хедеров.
|
||||
//-----------------------
|
||||
Vector<String> result_lines = new Vector<>();
|
||||
Vector<String> all_includes = new Vector<>();
|
||||
//-----------------------------
|
||||
result_lines.add("!-Found " + target.allIncludes.size() + " headers");
|
||||
for (String name : target.allIncludes.keySet()) {
|
||||
all_includes.add(" include " + Utils_.Quotes(Utils_.toU(name)));
|
||||
result_lines.add("! include " + Utils_.Quotes(Utils_.toU(name)));
|
||||
}
|
||||
result_lines.add("!-Collapse-" + target.files_order.size() + " files");
|
||||
int i = 1;
|
||||
for (String name : target.files_order) {
|
||||
result_lines.add("! -- " + i + ". " + Utils_.Brackets(name));
|
||||
++i;
|
||||
}
|
||||
result_lines.add("!--------------------");
|
||||
for (String name : target.files_order) {
|
||||
//если есть инклуды начинаем мучиться.
|
||||
if (target.addictedFiles.containsKey(name)) {
|
||||
DBProjectFile file = target.db.files.Data.get(name);
|
||||
//---------------------------------------------------->>>
|
||||
List<String> file_lines = FileUtils.readLines(file.file);
|
||||
for (String line : file_lines) {
|
||||
String header = Utils.extractHeaderName(line);
|
||||
if (header != null) {
|
||||
if (file.relativeHeaders.containsKey(header))
|
||||
result_lines.add(" include " + Utils_.Quotes(
|
||||
Utils_.toU(
|
||||
file.relativeHeaders.get(header).name)));
|
||||
} else
|
||||
result_lines.add(line);
|
||||
}
|
||||
} else {
|
||||
//инклудов нет. добавляем все подряд.
|
||||
result_lines.addAll(FileUtils.readLines(target.db.files.Data.get(name).file));
|
||||
}
|
||||
}
|
||||
FileUtils.writeLines(result, result_lines, false);
|
||||
//-------------------------------
|
||||
//теперь скопировать остальные файлы
|
||||
for (String name : target.db.files.Data.keySet()) {
|
||||
if (!target.files_order.contains(name)) {
|
||||
Files.copy(
|
||||
target.db.files.Data.get(name).file.toPath(),
|
||||
Paths.get(target.last_version.Home.getAbsolutePath(), name)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
57
src/_VisualDVM/Passes/All/CompareDVMRunTasks.java
Normal file
57
src/_VisualDVM/Passes/All/CompareDVMRunTasks.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMTasks.DVMRunTask;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.util.Vector;
|
||||
public class CompareDVMRunTasks extends Pass<Vector<DVMRunTask>> {
|
||||
DVMRunTask master;
|
||||
DVMRunTask slave;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Comparsion.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
master = null;
|
||||
slave = null;
|
||||
//--
|
||||
target = Global.testingServer.db.dvmRunTasks.getCheckedItems();
|
||||
if (target.size() == 2) {
|
||||
if (UI_.Question("Назначить задачу " + Utils_.Brackets(target.get(0).getPK()) + " эталоном" +
|
||||
"\n(в случае отказа, будет назначена задача " + Utils_.Brackets(target.get(1).getPK()) + ")")) {
|
||||
master = target.get(0);
|
||||
slave = target.get(1);
|
||||
} else {
|
||||
master = target.get(1);
|
||||
slave = target.get(0);
|
||||
}
|
||||
return true;
|
||||
} else if (target.size() == 1) {
|
||||
master = target.get(0);
|
||||
slave = null;
|
||||
return UI_.Question("Отобразить задачу " + Utils_.Brackets(master.getPK()));
|
||||
} else if ((target.size() == 0) && (Global.mainModule.HasDVMRunTask())) {
|
||||
master = Global.mainModule.getDVMRunTask();
|
||||
slave = null;
|
||||
return UI_.Question("Отобразить задачу " + Utils_.Brackets(master.getPK()));
|
||||
} else {
|
||||
Log.Writeln_("Для сравнения требуется отметить две задачи.\nДля отображения требуется отметить одну задачу,или выделить её.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
if (slave != null)
|
||||
UI.getMainWindow().getTestingWindow().CompareDVMRunTasks(master, slave);
|
||||
else
|
||||
UI.getMainWindow().getTestingWindow().ShowDVMRunTask(master);
|
||||
}
|
||||
}
|
||||
58
src/_VisualDVM/Passes/All/CompareSapforPackages.java
Normal file
58
src/_VisualDVM/Passes/All/CompareSapforPackages.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.util.Vector;
|
||||
public class CompareSapforPackages extends Pass<Vector<SapforPackage>> {
|
||||
SapforPackage master;
|
||||
SapforPackage slave;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Comparsion.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
master = null;
|
||||
slave = null;
|
||||
//--
|
||||
target = Global.testingServer.db.sapforPackages.getCheckedItems();
|
||||
if (target.size() == 2) {
|
||||
if (UI_.Question("Назначить пакет " + Utils_.Brackets(target.get(0).getPK()) + " эталоном" +
|
||||
"\n(в случае отказа, будет назначен пакет " + Utils_.Brackets(target.get(1).getPK()) + ")")) {
|
||||
master = target.get(0);
|
||||
slave = target.get(1);
|
||||
} else {
|
||||
master = target.get(1);
|
||||
slave = target.get(0);
|
||||
}
|
||||
return true;
|
||||
} else if (target.size() == 1) {
|
||||
master = target.get(0);
|
||||
slave = null;
|
||||
return UI_.Question("Отобразить пакет " + Utils_.Brackets(master.getPK()));
|
||||
} else if ((target.size() == 0) && (Global.mainModule.HasSapforPackage())) {
|
||||
master =Global.mainModule.getSapforPackage();
|
||||
slave = null;
|
||||
return UI_.Question("Отобразить пакет " + Utils_.Brackets(master.getPK()));
|
||||
} else {
|
||||
Log.Writeln_("Для сравнения требуется отметить два пакета.\nДля отображения требуется отметить один пакет,или выделить его");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
if (slave != null)
|
||||
UI.getMainWindow().getTestingWindow().CompareSapforPackages(master, slave);
|
||||
else
|
||||
UI.getMainWindow().getTestingWindow().ShowSapforPackage(master);
|
||||
}
|
||||
}
|
||||
|
||||
91
src/_VisualDVM/Passes/All/Compile.java
Normal file
91
src/_VisualDVM/Passes/All/Compile.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
|
||||
import _VisualDVM.GlobalData.Tasks.TaskState;
|
||||
import _VisualDVM.GlobalData.User.UserState;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Passes.Pass;
|
||||
public class Compile extends Pass<db_project_info> {
|
||||
Pass subpass = null;
|
||||
CompilationTask compilationTask = null;
|
||||
@Override
|
||||
protected PassCode necessary() {
|
||||
return Global.mainModule.getProject().languageName.equals(LanguageName.fortran) ? PassCode.SPF_ParseFilesWithOrder : null;
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Start.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
if (Global.mainModule.Check(Log, Current.Project, Current.Machine, Current.User, Current.Makefile)) {
|
||||
target = Global.mainModule.getProject();
|
||||
subpass = null;
|
||||
compilationTask = null;
|
||||
if (Global.mainModule.getUser().state != UserState.ready_to_work)
|
||||
Log.Writeln_("Пользователь " + Utils_.Brackets(Global.mainModule.getUser().login) +
|
||||
" не проинициализирован\nПерейдите на вкладку 'Настройки компиляции и запуска',\n" +
|
||||
" и выполните команду 'Инициализация пользователя'\n");
|
||||
Global.mainModule.getMakefile().Validate(Log);
|
||||
return Log.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
compilationTask = new CompilationTask();
|
||||
compilationTask.machine_id = Global.mainModule.getMachine().id;
|
||||
compilationTask.user_id = Global.mainModule.getUser().id;
|
||||
compilationTask.makefile_id = Global.mainModule.getMakefile().id;
|
||||
compilationTask.project_path = target.Home.getAbsolutePath();
|
||||
compilationTask.project_description = target.description;
|
||||
//------------------------------------------
|
||||
compilationTask.CompleteSummary(target.compilation_maxtime);
|
||||
compilationTask.state = TaskState.Inactive;
|
||||
Global.mainModule.getDb().Insert(compilationTask);
|
||||
Utils.forceDeleteWithCheck(compilationTask.getLocalWorkspace());
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
Global.mainModule.getDb().compilationTasks.ShowUI(compilationTask.getPK());
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
|
||||
switch (Global.mainModule.getMachine().type) {
|
||||
case Local:
|
||||
if (Utils_.isWindows()) {
|
||||
subpass = Global.mainModule.getPass(PassCode.WindowsLocalCompilation);
|
||||
} else
|
||||
subpass = Global.mainModule.getPass(PassCode.LinuxLocalCompilation);
|
||||
break;
|
||||
case Undefined:
|
||||
case MVS_cluster:
|
||||
throw new PassException("Компиляция не реализована для типа машины " + Utils_.DQuotes(Global.mainModule.getMachine().type));
|
||||
default:
|
||||
subpass = Global.mainModule.getPass(PassCode.RemoteCompilation);
|
||||
break;
|
||||
}
|
||||
subpass.Do(Global.mainModule.getCompilationTask(), Global.mainModule.getProject());
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return (subpass != null) && subpass.isDone();
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
Global.mainModule.getDb().compilationTasks.ShowUI(compilationTask.getPK());
|
||||
UI.getDebugWindow().ShowLastCompilationTask();
|
||||
}
|
||||
}
|
||||
16
src/_VisualDVM/Passes/All/CompileServerSapfor.java
Normal file
16
src/_VisualDVM/Passes/All/CompileServerSapfor.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapforState;
|
||||
import _VisualDVM.Passes.Server.PublishServerObject;
|
||||
public class CompileServerSapfor extends PublishServerObject<TestingServer, ServerSapfor> {
|
||||
public CompileServerSapfor() {
|
||||
super(Global.testingServer, ServerSapfor.class);
|
||||
}
|
||||
@Override
|
||||
public boolean fillObjectFields() throws Exception {
|
||||
target.state= ServerSapforState.Queued;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
61
src/_VisualDVM/Passes/All/ConvertCorrectnessTests.java
Normal file
61
src/_VisualDVM/Passes/All/ConvertCorrectnessTests.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Server.TestingSystemPass;
|
||||
|
||||
import java.io.File;
|
||||
public class ConvertCorrectnessTests extends TestingSystemPass<File> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadAll.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected int getTimeout() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (!Global.mainModule.getAccount().isAdmin()) {
|
||||
Log.Writeln_("Вы не являетесь администратором");
|
||||
return false;
|
||||
}
|
||||
if (!Global.mainModule.Check(Log, Current.ServerSapfor)){
|
||||
return false;
|
||||
}
|
||||
return UI_.Warning("Загрузить полный пакет DVM тестов на корректность и производительность.");
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentProject);
|
||||
Global.mainModule.set(Current.Root, null);
|
||||
Global.mainModule.set(Current.Version, null);
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
UI.testingBar.ShowAutoCheckTesting();
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.RefreshDVMTests,
|
||||
String.valueOf(Global.mainModule.getServerSapfor().id), Global.mainModule.getAccount()));
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
Global.mainModule.getPass(PassCode.SynchronizeTests).Do();
|
||||
}
|
||||
}
|
||||
|
||||
70
src/_VisualDVM/Passes/All/CopyProject.java
Normal file
70
src/_VisualDVM/Passes/All/CopyProject.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.Dialog;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Passes.Project.CurrentProjectPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Visual.Windows.CopyProjectFields;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class CopyProject extends CurrentProjectPass {
|
||||
protected File dstFile = null;
|
||||
protected boolean migrateData = false;
|
||||
@Override
|
||||
public boolean hasStats() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (super.canStart(args)) {
|
||||
Dialog<Object, CopyProjectFields> dialog = new Dialog<Object, CopyProjectFields>(CopyProjectFields.class) {
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 230;
|
||||
}
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
fields.tfParent.setText(Global.visualiser.getWorkspace().getAbsolutePath());
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
Utils.validateFileShortNewName(fields.tfName.getText(), Log);
|
||||
if (!fields.tfParent.getText().isEmpty()) {
|
||||
if (Utils_.ContainsCyrillic(fields.tfParent.getText()))
|
||||
Log.Writeln_("Путь к целевой папке не может содержать кириллицу!");
|
||||
} else Log.Writeln_("Путь к целевой папке не может быть пустым!");
|
||||
if (Log.isEmpty()) {
|
||||
dstFile = Paths.get(fields.tfParent.getText(), fields.tfName.getText()).toFile();
|
||||
if (dstFile.exists())
|
||||
Log.Writeln_("Файл " + dstFile.getAbsolutePath() + " уже существует!");
|
||||
}
|
||||
}
|
||||
};
|
||||
if (dialog.ShowDialog(getDescription())) {
|
||||
migrateData = dialog.fields.MigrateData.isSelected();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Transformations/CopyProject.png";
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
FileUtils.forceMkdir(dstFile);
|
||||
target.Clone(dstFile, migrateData);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
if (UI_.Question("копия текущего проекта успешно создана по адресу\n" + dstFile.getAbsolutePath() + "\nОткрыть её")) {
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
||||
Global.mainModule.getPass(PassCode.OpenCurrentProject).Do(dstFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/_VisualDVM/Passes/All/CreateComponentBackUp.java
Normal file
13
src/_VisualDVM/Passes/All/CreateComponentBackUp.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Passes.CurrentComponentPass;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
public class CreateComponentBackUp extends CurrentComponentPass {
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
//form.ShowMessage2("копирование предыдущей версии...");
|
||||
if (target.getFile().exists())
|
||||
Files.copy(target.getFile().toPath(), target.getBackUpFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Passes.Pass;
|
||||
public class CreateDVMPackageFromCurrentProject extends Pass {
|
||||
}
|
||||
41
src/_VisualDVM/Passes/All/CreateEmptyDirectory.java
Normal file
41
src/_VisualDVM/Passes/All/CreateEmptyDirectory.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.Text.FileNameForm;
|
||||
import _VisualDVM.Passes.Project.ChangeFilePass;
|
||||
import Common.Passes.PassException;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class CreateEmptyDirectory extends ChangeFilePass {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
resetArgs();
|
||||
if ((ff = new FileNameForm()).ShowDialog("Введите имя создаваемой папки")) {
|
||||
fileName = ff.Result;
|
||||
//->
|
||||
parent_node = Global.mainModule.getProjectCurrentParentNode();
|
||||
target_dir = (File) parent_node.getUserObject();
|
||||
//->
|
||||
dst = Paths.get(target_dir.getAbsolutePath(), fileName).toFile();
|
||||
if (dst.exists()) {
|
||||
Log.Writeln("Файл с именем " + Utils_.Brackets(fileName) + " уже существует");
|
||||
return false;
|
||||
}
|
||||
if (fileName.equalsIgnoreCase(Constants.data)) {
|
||||
Log.Writeln(Utils_.Brackets(Constants.data) + " является зарезервированным именем!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
if (!dst.mkdir()) throw new PassException("Не удалось создать папку.");
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().AddNode(parent_node, dst_node = new DefaultMutableTreeNode(dst));
|
||||
}
|
||||
}
|
||||
46
src/_VisualDVM/Passes/All/CreateEmptyProject.java
Normal file
46
src/_VisualDVM/Passes/All/CreateEmptyProject.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.Text.FileNameForm;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class CreateEmptyProject extends Pass<File> {
|
||||
String project_name;
|
||||
FileNameForm ff = new FileNameForm();
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/CreateProject.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
project_name = "";
|
||||
target = null;
|
||||
if (ff.ShowDialog("Укажите имя создаваемого проекта", "NewProject")) {
|
||||
project_name = ff.Result;
|
||||
target = Paths.get(Global.visualiser.getWorkspace().getAbsolutePath(), project_name).toFile();
|
||||
if (target.exists())
|
||||
Log.Writeln("Файл\n" + Utils_.Brackets(target.getAbsolutePath()) + "\nуже существует");
|
||||
return Log.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
File data = new File(target, Constants.data);
|
||||
if (!(target.mkdir()&&data.mkdir()))
|
||||
throw new PassException("Не удалось создать проект.");
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Global.mainModule.getPass(PassCode.OpenCurrentProject).Do(target);
|
||||
}
|
||||
}
|
||||
68
src/_VisualDVM/Passes/All/CreateGroupFromDirectory.java
Normal file
68
src/_VisualDVM/Passes/All/CreateGroupFromDirectory.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import Common.Visual.Windows.Dialog.VDirectoryChooser;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
public class CreateGroupFromDirectory extends PublishTests {
|
||||
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки группы");
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/OpenProject.png";
|
||||
}
|
||||
@Override
|
||||
protected PassCode getCreateTestCode() {
|
||||
return PassCode.CreateTestFromDirectory;
|
||||
}
|
||||
@Override
|
||||
protected String getNoFilesMessage() {
|
||||
return "ни одной папки";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
Utils.RestoreSelectedDirectory(directoryChooser);
|
||||
File dir = directoryChooser.ShowDialog();
|
||||
if (dir == null) {
|
||||
Log.Writeln_("Папка не выбрана");
|
||||
return false;
|
||||
}
|
||||
//---------------
|
||||
if (!dir.isDirectory()) {
|
||||
Log.Writeln_(Utils_.Brackets(dir) + "\nне является папкой!");
|
||||
return false;
|
||||
}
|
||||
if (dir.getName().equals(Constants.data)) {
|
||||
Log.Writeln_(Utils_.Brackets(dir) + "\nявляется служебной папкой визуализатора!");
|
||||
return false;
|
||||
}
|
||||
if (!Utils.validateProjectFile(dir, Log)) {
|
||||
Log.Writeln_("Имя папки " + Utils_.Brackets(dir.getName())
|
||||
+ " содержит запрещённые символы " +
|
||||
Utils_.printAllForbiddenCharacters() + ", или кириллицу.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
File[] files_ = dir.listFiles(File::isDirectory);
|
||||
if (files_ == null) {
|
||||
Log.Writeln_("Ошибка при получении списка подпапок");
|
||||
return false;
|
||||
}
|
||||
if (files_.length == 0) {
|
||||
Log.Writeln_("В выбранной папке не найдено ни одной папки");
|
||||
return false;
|
||||
}
|
||||
if ( Global.mainModule.getPass(PassCode.PublishGroup).Do(dir.getName().toUpperCase())) {
|
||||
group = Global.mainModule.getGroup();
|
||||
} else return false;
|
||||
//---------------
|
||||
Vector<File> files = new Vector<>(Arrays.asList(files_));
|
||||
Global.mainModule.getPass(PassCode.UpdateSetting).Do(SettingName.ProjectsSearchDirectory, directoryChooser.getCurrentDirectory());
|
||||
return super.canStart(files, group);
|
||||
}
|
||||
}
|
||||
52
src/_VisualDVM/Passes/All/CreateGroupFromFiles.java
Normal file
52
src/_VisualDVM/Passes/All/CreateGroupFromFiles.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import Common.Visual.Windows.Dialog.VFileChooser;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class CreateGroupFromFiles extends PublishTests{
|
||||
Group group;
|
||||
VFileChooser fileChooser = new VFileChooser("Выберите файлы для создания тестов");
|
||||
|
||||
@Override
|
||||
protected PassCode getCreateTestCode() {
|
||||
return PassCode.CreateTestFromFile;
|
||||
}
|
||||
@Override
|
||||
protected String getNoFilesMessage() {
|
||||
return "ни одного файла";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
Utils.RestoreSelectedDirectory(fileChooser);
|
||||
Vector<File> files = fileChooser.ShowMultiDialog();
|
||||
if (files.isEmpty()){
|
||||
Log.Writeln_("Не выбрано ни одного файла.");
|
||||
return false;
|
||||
}
|
||||
File dir = fileChooser.getCurrentDirectory();
|
||||
Global.mainModule.getPass(PassCode.UpdateSetting).Do(SettingName.ProjectsSearchDirectory, dir);
|
||||
//---------------
|
||||
if (dir.getName().equals(Constants.data)) {
|
||||
Log.Writeln_(Utils_.Brackets(dir) + "\nявляется служебной папкой визуализатора!");
|
||||
return false;
|
||||
}
|
||||
if (!Utils.validateProjectFile(dir, Log)) {
|
||||
Log.Writeln_("Имя папки " + Utils_.Brackets(dir.getName())
|
||||
+ " содержит запрещённые символы "
|
||||
+ Utils_.printAllForbiddenCharacters() + ", или кириллицу.");
|
||||
return false;
|
||||
}
|
||||
if ( Global.mainModule.getPass(PassCode.PublishGroup).Do(dir.getName().toUpperCase())) {
|
||||
group = Global.mainModule.getGroup();
|
||||
} else return false;
|
||||
//--
|
||||
return super.canStart(files, group);
|
||||
}
|
||||
}
|
||||
28
src/_VisualDVM/Passes/All/CreateParallelVariants.java
Normal file
28
src/_VisualDVM/Passes/All/CreateParallelVariants.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Sapfor.VariantsMassPass;
|
||||
public class CreateParallelVariants extends VariantsMassPass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Create.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public PassCode getSubPassCode() {
|
||||
return PassCode.SPF_CreateParallelVariant;
|
||||
}
|
||||
@Override
|
||||
protected void FocusResult() {
|
||||
UI.getMainWindow().getProjectWindow().FocusVersions();
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
db_project_info.ResetNewVersions();
|
||||
super.performPreparation();
|
||||
}
|
||||
}
|
||||
219
src/_VisualDVM/Passes/All/CreateTestFromDirectory.java
Normal file
219
src/_VisualDVM/Passes/All/CreateTestFromDirectory.java
Normal file
@@ -0,0 +1,219 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.Windows.Dialog.VDirectoryChooser;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.ProjectData.Files.ProjectFile;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.Repository.Component.Sapfor.Sapfor;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Passes.Pass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
public class CreateTestFromDirectory extends Pass<Test> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/OpenProject.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
Group group = null;
|
||||
File dir = null;
|
||||
boolean from_files_chooser = false;
|
||||
//--
|
||||
void saveDirectory() {
|
||||
Global.mainModule.getPass(PassCode.UpdateSetting).Do(SettingName.ProjectsSearchDirectory,
|
||||
(dir.getParentFile() == null) ? dir.getAbsolutePath() : dir.getParent()
|
||||
);
|
||||
}
|
||||
Vector<File> files = null;
|
||||
protected boolean selectFiles() {
|
||||
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки теста");
|
||||
Utils.RestoreSelectedDirectory(directoryChooser);
|
||||
dir = directoryChooser.ShowDialog();
|
||||
if (dir == null) {
|
||||
Log.Writeln_("Папка не выбрана.");
|
||||
return false;
|
||||
} else {
|
||||
files = new Vector<>(Arrays.asList(dir.listFiles()));
|
||||
saveDirectory();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
Vector<ProjectFile> project_files = new Vector<>();
|
||||
protected boolean initTarget() throws Exception {
|
||||
target = new Test();
|
||||
target.sender_address = Global.mainModule.getAccount().email;
|
||||
target.sender_name = Global.mainModule.getAccount().name;
|
||||
target.group_id = group.id;
|
||||
target.description = dir.getName();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
files = null;
|
||||
if (args.length == 0) {
|
||||
//--
|
||||
from_files_chooser = true;
|
||||
if (!Global.mainModule.Check(Log, Current.Group))
|
||||
return false;
|
||||
group = Global.mainModule.getGroup();
|
||||
if (!selectFiles())
|
||||
return false;
|
||||
//-
|
||||
} else {
|
||||
from_files_chooser = false;
|
||||
dir = (File) args[0];
|
||||
group = (Group) args[1];
|
||||
files = new Vector<>(Arrays.asList(dir.listFiles()));
|
||||
}
|
||||
//---
|
||||
int subdirs = 0;
|
||||
int bad = 0;
|
||||
int active_programs = 0;
|
||||
int headers = 0;
|
||||
int other_project_files = 0;
|
||||
//---
|
||||
if (dir.getName().equalsIgnoreCase(Constants.data)) {
|
||||
Log.Writeln_("Папка " + Utils_.Brackets(dir) + " является служебной папкой визуализатора.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if (Utils_.ContainsCyrillic(dir.getName()) || Utils_.ContainsForbiddenName(dir.getName())) {
|
||||
Log.Writeln_("Имя папки " + Utils_.Brackets(dir.getName())
|
||||
+ " содержит запрещённые символы "
|
||||
+ Utils_.printAllForbiddenCharacters() + ", или кириллицу.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if (files == null) {
|
||||
Log.Writeln_("Не удалось получить список файлов для папки " + Utils_.Brackets(dir) + ".");
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
project_files = new Vector<>();
|
||||
//--
|
||||
for (File file : files) {
|
||||
//-----
|
||||
if (file.isDirectory()) {
|
||||
//если это подпапка нам все равно на каком она языке. не версия и не служебная. ее наличие уже не допустимо.
|
||||
if (!file.getName().equalsIgnoreCase(Constants.data) &&
|
||||
!Utils.isVersion(file)) {
|
||||
subdirs++;
|
||||
}
|
||||
} else if (file.isFile() && !Utils_.ContainsCyrillic(file.getName()) && !Utils_.ContainsForbiddenName(file.getName())) {
|
||||
//если файл. все недопустимые файлы просто игнорируются.
|
||||
ProjectFile projectFile = new ProjectFile(file);
|
||||
if (isNotExcluded(projectFile)) {
|
||||
switch (projectFile.fileType) {
|
||||
case program:
|
||||
if (projectFile.languageName.equals(group.language)) {
|
||||
active_programs++;
|
||||
project_files.add(projectFile);
|
||||
} else
|
||||
other_project_files++;
|
||||
break;
|
||||
case header:
|
||||
headers++;
|
||||
project_files.add(projectFile);
|
||||
break;
|
||||
case none:
|
||||
project_files.add(projectFile);
|
||||
other_project_files++;
|
||||
break;
|
||||
default:
|
||||
other_project_files++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//--
|
||||
if (subdirs > 0) {
|
||||
Log.Writeln_("Папка " + Utils_.Brackets(dir) + " содержит вложенные подпапки,\n" +
|
||||
"не являющиеся версиями или данными визуализатора");
|
||||
return false;
|
||||
}
|
||||
if (active_programs == 0) {
|
||||
Log.Writeln_("Папка не содержит ни одной программы на языке " + group.language.getDescription() + ".");
|
||||
return false;
|
||||
}
|
||||
if (project_files.isEmpty()) {
|
||||
Log.Writeln_("В папке не найдено файлов с допустимыми расширениями для языка " +
|
||||
group.language.getDescription() + "\n" +
|
||||
group.language.PrintExtensions()
|
||||
);
|
||||
}
|
||||
//----
|
||||
if (!initTarget()) return false;
|
||||
//----
|
||||
Vector<String> filesNames = new Vector<>();
|
||||
for (ProjectFile projectFile : project_files)
|
||||
filesNames.add(projectFile.file.getName());
|
||||
target.files = String.join("\n", filesNames);
|
||||
return true;
|
||||
}
|
||||
public boolean isNotExcluded(ProjectFile projectFile) {
|
||||
return true;
|
||||
}
|
||||
//-
|
||||
public File packTestCode() throws Exception {
|
||||
target.temp_project_name = Utils_.getDateName("test");
|
||||
//-
|
||||
File tempProject = target.getTempProject();
|
||||
File tempArchive = target.getTempArchive();
|
||||
//- создать бд.
|
||||
FileUtils.forceMkdir(tempProject);
|
||||
//--
|
||||
for (ProjectFile projectFile : project_files) {
|
||||
File dst = new File(tempProject, projectFile.file.getName());
|
||||
FileUtils.copyFile(projectFile.file, dst);
|
||||
}
|
||||
//---
|
||||
Utils.ClearProjectData(tempProject);
|
||||
//--
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
if (zip.Do(tempProject.getAbsolutePath(), tempArchive.getAbsolutePath())) {
|
||||
target.project_archive_bytes = Utils_.fileToBytes(tempArchive);
|
||||
} else throw new PassException("Не удалось создать архив папки с кодом.");
|
||||
return tempProject;
|
||||
}
|
||||
//-
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
ShowMessage1(dir.getName());
|
||||
//--
|
||||
File tempProject = packTestCode(); //создание копии папки, и архивация.
|
||||
//-- получить размерность консольным сапфором. папка уже отправлена и чистить ее не нужно!!
|
||||
ShowMessage2("Синтаксический анализ и определение размерности");
|
||||
if (group.language == LanguageName.fortran) {//если не определит, будут нули.
|
||||
Sapfor.getMinMaxDim(Sapfor.getTempCopy(Global.mainModule.getSapfor().getFile()), tempProject, target);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return Log.isEmpty();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
if (from_files_chooser)
|
||||
Global.mainModule.getPass(PassCode.PublishTest).Do(target);
|
||||
}
|
||||
}
|
||||
89
src/_VisualDVM/Passes/All/CreateTestFromFile.java
Normal file
89
src/_VisualDVM/Passes/All/CreateTestFromFile.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.ProjectData.Files.FileType;
|
||||
import _VisualDVM.ProjectData.Files.ProjectFile;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.Repository.Component.Sapfor.Sapfor;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Passes.Pass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
public class CreateTestFromFile extends Pass<Test> {
|
||||
//----
|
||||
Group group;
|
||||
ProjectFile projectFile;
|
||||
//----
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/AddFile.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
projectFile = null;
|
||||
File file_in = (File) args[0];
|
||||
group = (Group) args[1];
|
||||
//--
|
||||
if (Utils_.ContainsCyrillic(file_in.getName()) || Utils_.ContainsForbiddenName(file_in.getName())) {
|
||||
Log.Writeln_("Имя файла " + Utils_.Brackets(file_in.getName())
|
||||
+ " содержит запрещённые символы " +
|
||||
Utils_.printAllForbiddenCharacters() + ", или кириллицу.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
projectFile = new ProjectFile(file_in);
|
||||
if (!projectFile.fileType.equals(FileType.program) || !projectFile.languageName.equals(group.language)) {
|
||||
Log.Writeln_("Не удалось распознать файл " + Utils_.Brackets(file_in.getName()) +
|
||||
" как программу на языке " + group.language.getDescription());
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
target = new Test();
|
||||
target.sender_address = Global.mainModule.getAccount().email;
|
||||
target.sender_name = Global.mainModule.getAccount().name;
|
||||
target.group_id = group.id;
|
||||
target.description = Utils_.getNameWithoutExtension(file_in.getName());
|
||||
target.files = file_in.getName();
|
||||
return true;
|
||||
}
|
||||
public File packTestCode() throws Exception {
|
||||
target.temp_project_name = Utils_.getDateName("test");
|
||||
//-
|
||||
File tempProject = target.getTempProject();
|
||||
File tempArchive = target.getTempArchive();
|
||||
//- создать бд.
|
||||
FileUtils.forceMkdir(tempProject);
|
||||
//--
|
||||
File dst = new File(tempProject, projectFile.file.getName());
|
||||
FileUtils.copyFile(projectFile.file, dst);
|
||||
//---
|
||||
Utils.ClearProjectData(tempProject);
|
||||
//--
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
if (zip.Do(tempProject.getAbsolutePath(), tempArchive.getAbsolutePath())) {
|
||||
target.project_archive_bytes = Utils_.fileToBytes(tempArchive);
|
||||
} else throw new PassException("Не удалось создать архив папки с кодом.");
|
||||
return tempProject;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
ShowMessage1(projectFile.file.getName());
|
||||
//--
|
||||
File tempProject = packTestCode();
|
||||
ShowMessage2("Синтаксический анализ и определение размерности");
|
||||
if (group.language == LanguageName.fortran)
|
||||
Sapfor.getMinMaxDim(Sapfor.getTempCopy(Global.mainModule.getSapfor().getFile()), tempProject, target);
|
||||
}
|
||||
}
|
||||
42
src/_VisualDVM/Passes/All/CreateTestFromProject.java
Normal file
42
src/_VisualDVM/Passes/All/CreateTestFromProject.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.ProjectData.Files.FileState;
|
||||
import _VisualDVM.ProjectData.Files.ProjectFile;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
//из текущего проекта.
|
||||
public class CreateTestFromProject extends CreateTestFromDirectory {
|
||||
db_project_info project;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/RedAdd.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (args.length == 0) {
|
||||
if (Global.mainModule.Check(Log, Current.Group, Current.Project)) {
|
||||
project = Global.mainModule.getProject();
|
||||
if (super.canStart(Global.mainModule.getProject().Home, Global.mainModule.getGroup())){
|
||||
from_files_chooser = true; //чтобы опубликовал.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
project = (db_project_info) args[0];
|
||||
group = (Group) args[1];
|
||||
//если проект не текущий, освежить его бд.
|
||||
if (!Global.mainModule.HasProject() || !Global.mainModule.getProject().Home.equals(project.Home)) {
|
||||
project.Open();
|
||||
project.Close();
|
||||
}
|
||||
return super.canStart(project.Home, group);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isNotExcluded(ProjectFile projectFile) {
|
||||
return project.db.files.containsKey(projectFile.file.getName()) &&
|
||||
!project.db.files.get(projectFile.file.getName()).state.equals(FileState.Excluded);
|
||||
}
|
||||
}
|
||||
27
src/_VisualDVM/Passes/All/CreateTestFromSelectedFiles.java
Normal file
27
src/_VisualDVM/Passes/All/CreateTestFromSelectedFiles.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Visual.Windows.Dialog.VFileChooser;
|
||||
import _VisualDVM.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class CreateTestFromSelectedFiles extends CreateTestFromDirectory {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/MassFiles.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean selectFiles() {
|
||||
VFileChooser files_chooser = new VFileChooser("Выбор файлов");
|
||||
Utils.RestoreSelectedDirectory(files_chooser);
|
||||
Vector<File> res = files_chooser.ShowMultiDialog();
|
||||
dir = files_chooser.getCurrentDirectory();
|
||||
if (res.isEmpty()){
|
||||
Log.Writeln_("Не выбрано ни одного файла.");
|
||||
return false;
|
||||
} else {
|
||||
this.files = res;
|
||||
saveDirectory();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
35
src/_VisualDVM/Passes/All/CreateTestsFromFiles.java
Normal file
35
src/_VisualDVM/Passes/All/CreateTestsFromFiles.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.Windows.Dialog.VFileChooser;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class CreateTestsFromFiles extends PublishTests {
|
||||
VFileChooser fileChooser = new VFileChooser("Выберите файлы для создания тестов");
|
||||
@Override
|
||||
protected PassCode getCreateTestCode() {
|
||||
return PassCode.CreateTestFromFile;
|
||||
}
|
||||
@Override
|
||||
protected String getNoFilesMessage() {
|
||||
return "ни одного файла";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Global.mainModule.Check(Log, Current.Group)){
|
||||
Utils.RestoreSelectedDirectory(fileChooser);
|
||||
Vector<File> files = fileChooser.ShowMultiDialog();
|
||||
if (files.isEmpty()){
|
||||
Log.Writeln_("Не выбрано ни одного файла.");
|
||||
return false;
|
||||
}
|
||||
Global.mainModule.getPass(PassCode.UpdateSetting).Do(SettingName.ProjectsSearchDirectory, fileChooser.getCurrentDirectory());
|
||||
return super.canStart(files, Global.mainModule.getGroup());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.util.Vector;
|
||||
public class CreateTestsGroupFromSelectedVersions extends PublishTests {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Publish.png";
|
||||
}
|
||||
@Override
|
||||
protected PassCode getCreateTestCode() {
|
||||
return PassCode.CreateTestFromProject;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = new Vector<>();
|
||||
//---
|
||||
if (Global.mainModule.Check(Log, Current.Group)) {
|
||||
group = Global.mainModule.getGroup();
|
||||
} else
|
||||
return false;
|
||||
//---------------------
|
||||
Vector<db_project_info> versions = new Vector<>();
|
||||
Global.mainModule.getRoot().getSelectedVersions(versions);
|
||||
if (versions.isEmpty()) {
|
||||
Log.Writeln_("Не отмечено ни одной версии.");
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
Pass createTestPass = Global.mainModule.getPass(getCreateTestCode());
|
||||
//---
|
||||
for (db_project_info version : versions) {
|
||||
if (createTestPass.Do(version, group))
|
||||
target.add((Test) createTestPass.target);
|
||||
}
|
||||
//---
|
||||
if (target.isEmpty()) {
|
||||
Log.Writeln_("Не удалось создать ни одного теста.");
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
return UI_.Question("В группу " + Utils_.Brackets(group.description) +
|
||||
"\nбудет добавлено " + target.size() + " тестов.\nПродолжить");
|
||||
}
|
||||
}
|
||||
156
src/_VisualDVM/Passes/All/DVMConvertProject.java
Normal file
156
src/_VisualDVM/Passes/All/DVMConvertProject.java
Normal file
@@ -0,0 +1,156 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.Menus.PassMenuItem;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class DVMConvertProject extends ComponentsRepositoryPass<db_project_info> {
|
||||
File workspace = null;
|
||||
File archive = null;
|
||||
Vector<DBProjectFile> programsToConvert = null;
|
||||
Vector<String> programsNames = null;
|
||||
String output = null;
|
||||
File versionArchive = null;
|
||||
File version = null;
|
||||
String badFiles = "";
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
programsToConvert = null;
|
||||
programsNames = null;
|
||||
output = "";
|
||||
workspace = null;
|
||||
archive = null;
|
||||
versionArchive = null;
|
||||
version = null;
|
||||
badFiles = "";
|
||||
//--
|
||||
if (Global.mainModule.Check(Log, Current.Project)) {
|
||||
target = Global.mainModule.getProject();
|
||||
programsToConvert = target.getPrograms().get(target.languageName);
|
||||
programsNames = new Vector<>();
|
||||
if (programsToConvert.size() > 100) {
|
||||
Log.Writeln_("Количество активных файлов кода на языке " + target.languageName + " в проекте превышает 100.");
|
||||
return false;
|
||||
}
|
||||
for (DBProjectFile program : programsToConvert) {
|
||||
if (Utils_.getFileSizeMegaBytes(program.file) > 1) {
|
||||
Log.Writeln_("Размер файла кода " + Utils_.Brackets(program.name) + " превышает 1 Мб.");
|
||||
return false;
|
||||
} else programsNames.add(Utils_.toU(program.name));
|
||||
}
|
||||
workspace = Utils.getTempFileName("convertation");
|
||||
FileUtils.forceMkdir(workspace);
|
||||
File cleanCopy = Paths.get(workspace.getAbsolutePath(), target.name).toFile();
|
||||
FileUtils.forceMkdir(cleanCopy);
|
||||
archive = Paths.get(workspace.getAbsolutePath(), target.name + ".zip").toFile();
|
||||
target.Clone(cleanCopy, false);
|
||||
if (! Global.mainModule.getPass(PassCode.ZipFolderPass).Do(cleanCopy.getAbsolutePath(), archive.getAbsolutePath())) {
|
||||
Log.Writeln_("Не удалось создать архив проекта!");
|
||||
return false;
|
||||
}
|
||||
;
|
||||
if (Utils_.getFileSizeMegaBytes(archive) > 500) {
|
||||
Log.Writeln_("Размер архива проекта превышает 500 МБ");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
super.performPreparation();
|
||||
db_project_info.ResetNewVersions();
|
||||
}
|
||||
//-
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Transformations/" + getName() + ".png";
|
||||
}
|
||||
@Override
|
||||
public boolean hasStats() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected int getTimeout() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
ServerExchangeUnit_2021 unit = new ServerExchangeUnit_2021(ServerCode.DVMConvertProject);
|
||||
unit.object = Utils_.fileToBytes(archive);
|
||||
Vector<String> unit_args = new Vector<>();
|
||||
unit_args.add(target.name);
|
||||
unit_args.add(target.languageName.toString());
|
||||
unit_args.add((Global.mainModule.getDb()).settings.get(SettingName.DVMConvertationOptions).toString());
|
||||
unit_args.addAll(programsNames);
|
||||
unit.arg = String.join("\n", unit_args);
|
||||
Command(unit);
|
||||
output = response.arg;
|
||||
versionArchive = new File(workspace, target.name + "_result.zip");
|
||||
response.Unpack(versionArchive);
|
||||
File result = new File(workspace, "result");
|
||||
if ( Global.mainModule.getPass(PassCode.UnzipFolderPass).Do(versionArchive.getAbsolutePath(), result.getAbsolutePath())) {
|
||||
if (target.last_modification == null) {
|
||||
target.last_modification = new db_project_info(target,
|
||||
"m",
|
||||
"копия от " + new Date(),
|
||||
"");
|
||||
target.last_modification.CloneParent();
|
||||
}
|
||||
File resultProject = new File(result, target.name);
|
||||
String versionName = target.GenerateVersionName("v");
|
||||
version = new File(target.Home, versionName);
|
||||
FileUtils.moveDirectory(resultProject, version);
|
||||
if (!version.exists()) Log.Writeln_("Не удалось перенести результат");
|
||||
} else Log.Writeln_("Не удалось распаковать результат");
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
String[] data = output.split("\\|");
|
||||
if (data.length > 1) {
|
||||
badFiles = "Не удалось сконвертировать " + data[0].split("\n").length + " файлов:\n" + data[0];
|
||||
target.updateCompilationOut(data[1]);
|
||||
} else
|
||||
target.updateCompilationOut(output);
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
UI.getMainWindow().getProjectWindow().RefreshProjectTreeAndMessages();
|
||||
if (Global.mainModule.HasFile()) {
|
||||
Global.mainModule.getFile().form.ShowCompilationOutput();
|
||||
if (!output.isEmpty())
|
||||
Global.mainModule.getFile().form.FocusCompilationOut();
|
||||
}
|
||||
if (!badFiles.isEmpty())
|
||||
UI_.Error(badFiles);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
target.joinExistingVersion(version, getDescription());
|
||||
target.migrateFilesSettings(target.last_version, false, false);
|
||||
}
|
||||
@Override
|
||||
public JMenuItem createMenuItem() {
|
||||
if (menuItem == null)
|
||||
menuItem = new PassMenuItem(this);
|
||||
return menuItem;
|
||||
}
|
||||
}
|
||||
24
src/_VisualDVM/Passes/All/DeleteBugReport.java
Normal file
24
src/_VisualDVM/Passes/All/DeleteBugReport.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import Common.Passes.DeleteObjectPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class DeleteBugReport extends DeleteObjectPass<BugReport> {
|
||||
public DeleteBugReport() {
|
||||
super(BugReport.class);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart(args) && Global.mainModule.getAccount().CheckAccessRights(target.sender_address, Log);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
Global.mainModule.getPass(PassCode.DeleteBugReportFromServer).Do(target);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.componentsServer.db;
|
||||
}
|
||||
}
|
||||
17
src/_VisualDVM/Passes/All/DeleteBugReportFromServer.java
Normal file
17
src/_VisualDVM/Passes/All/DeleteBugReportFromServer.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Repository.BugReport.BugReportState;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
public class DeleteBugReportFromServer extends ComponentsRepositoryPass<BugReport> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
target = (BugReport) args[0];
|
||||
return !target.state.equals(BugReportState.draft);
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DeleteObject,"", target));
|
||||
}
|
||||
}
|
||||
8
src/_VisualDVM/Passes/All/DeleteCompiler.java
Normal file
8
src/_VisualDVM/Passes/All/DeleteCompiler.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Passes.DeleteObjectPass;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
public class DeleteCompiler extends DeleteObjectPass<Compiler> {
|
||||
public DeleteCompiler() {
|
||||
super(Compiler.class);
|
||||
}
|
||||
}
|
||||
10
src/_VisualDVM/Passes/All/DeleteConfiguration.java
Normal file
10
src/_VisualDVM/Passes/All/DeleteConfiguration.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
||||
import _VisualDVM.Passes.Server.DeleteServerObjects;
|
||||
public class DeleteConfiguration extends DeleteServerObjects<TestingServer, DVMConfiguration> {
|
||||
public DeleteConfiguration() {
|
||||
super(Global.testingServer, DVMConfiguration.class);
|
||||
}
|
||||
}
|
||||
21
src/_VisualDVM/Passes/All/DeleteDVMPackage.java
Normal file
21
src/_VisualDVM/Passes/All/DeleteDVMPackage.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
import _VisualDVM.Passes.Testing.DeleteTestingPackages;
|
||||
|
||||
import java.io.File;
|
||||
public class DeleteDVMPackage extends DeleteTestingPackages<DVMPackage> {
|
||||
public DeleteDVMPackage() {
|
||||
super(DVMPackage.class);
|
||||
}
|
||||
protected void showPreparation() throws Exception {
|
||||
super.showPreparation();
|
||||
UI.getMainWindow().getTestingWindow().DropTestRunTasksComparison();
|
||||
}
|
||||
@Override
|
||||
protected File getPackagesHome() {
|
||||
return Global.DVMPackagesDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
8
src/_VisualDVM/Passes/All/DeleteDVMParameter.java
Normal file
8
src/_VisualDVM/Passes/All/DeleteDVMParameter.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.GlobalData.DVMParameter.DVMParameter;
|
||||
import Common.Passes.DeleteObjectPass;
|
||||
public class DeleteDVMParameter extends DeleteObjectPass<DVMParameter> {
|
||||
public DeleteDVMParameter() {
|
||||
super(DVMParameter.class);
|
||||
}
|
||||
}
|
||||
10
src/_VisualDVM/Passes/All/DeleteDVMSettings.java
Normal file
10
src/_VisualDVM/Passes/All/DeleteDVMSettings.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMSettings.DVMSettings;
|
||||
import _VisualDVM.Passes.Server.DeleteServerObjects;
|
||||
public class DeleteDVMSettings extends DeleteServerObjects<TestingServer, DVMSettings> {
|
||||
public DeleteDVMSettings() {
|
||||
super(Global.testingServer, DVMSettings.class);
|
||||
}
|
||||
}
|
||||
29
src/_VisualDVM/Passes/All/DeleteDebugResults.java
Normal file
29
src/_VisualDVM/Passes/All/DeleteDebugResults.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Tasks.Task;
|
||||
import _VisualDVM.Passes.Project.CurrentProjectPass;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
public class DeleteDebugResults extends CurrentProjectPass {
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
Global.mainModule.getDb().compilationTasks.ClearUI();
|
||||
Global.mainModule.getDb().runTasks.ClearUI();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Vector<Task> toDelete = Global.mainModule.getDb().compilationTasks.Data.values().stream().filter(task -> task.belongsToProject(target)).collect(Collectors.toCollection(Vector::new));
|
||||
Global.mainModule.getDb().runTasks.Data.values().stream().filter(task -> task.belongsToProject(target)).forEach(toDelete::add);
|
||||
for (Task task : toDelete) {
|
||||
Utils.forceDeleteWithCheck(task.getLocalWorkspace());
|
||||
Global.mainModule.getDb().Delete(task);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
Global.mainModule.getDb().compilationTasks.ShowUI();
|
||||
Global.mainModule.getDb().runTasks.ShowUI();
|
||||
}
|
||||
}
|
||||
62
src/_VisualDVM/Passes/All/DeleteDirectory.java
Normal file
62
src/_VisualDVM/Passes/All/DeleteDirectory.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.Passes.Project.ChangeFilePass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.PassException;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class DeleteDirectory extends ChangeFilePass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
resetArgs();
|
||||
dst_node = Global.mainModule.getProjectNode();
|
||||
if ((dst_node != null) && (dst_node.getUserObject() instanceof File)) {
|
||||
target_dir = Global.mainModule.getSelectedDirectory();
|
||||
if (target_dir.equals(project.Home)) {
|
||||
Log.Writeln("Нельзя удалять домашнюю папку проекта.");
|
||||
return false;
|
||||
}
|
||||
return (UI_.Warning("Удалить папку\n" + Utils_.Brackets(target_dir.getAbsolutePath())
|
||||
+ "\n и всё её содержимое."));
|
||||
} else Log.Writeln_("Папка не выделена.");
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (Global.mainModule.HasFile() && (Utils.isAnchestor(Global.mainModule.getFile().file, target_dir)))
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentFile).Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
FileUtils.deleteDirectory(target_dir);
|
||||
if (target_dir.exists()) throw new PassException("Не удалось удалить папку");
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(dst_node);
|
||||
Vector<DBProjectFile> to_delete = new Vector<>();
|
||||
for (DBProjectFile file : project.db.files.Data.values()) {
|
||||
if (Utils.isAnchestor(file.file, target_dir))
|
||||
to_delete.add(file);
|
||||
}
|
||||
//так как имя первичный ключ приходится удалять их из бд проекта.
|
||||
for (DBProjectFile file : to_delete) {
|
||||
file.CleanAll();
|
||||
file.father.db.Delete(file);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Global.mainModule.set(Current.SelectedDirectory, null);
|
||||
Global.mainModule.set(Current.ProjectNode, null);
|
||||
}
|
||||
}
|
||||
68
src/_VisualDVM/Passes/All/DeleteDownloadedBugReports.java
Normal file
68
src/_VisualDVM/Passes/All/DeleteDownloadedBugReports.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.Dialog;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.FileObject.DirInfo;
|
||||
import _VisualDVM.GlobalData.FileObject.DirInfosDataSet;
|
||||
import _VisualDVM.GlobalData.FileObject.DirInfosFields;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import javax.swing.*;
|
||||
public class DeleteDownloadedBugReports extends Pass<DirInfosDataSet> {
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = null;
|
||||
if ( Global.mainModule.getPass(PassCode.GetOldBugReports).Do()){
|
||||
target = (DirInfosDataSet) Global.mainModule.getPass(PassCode.GetOldBugReports).target;
|
||||
if (target.Data.isEmpty()){
|
||||
Log.Writeln_("Не найдено отчетов, не использовавшихся " +
|
||||
(Global.mainModule.getDb()).settings.get(SettingName.BugReportsAgeLimit).toInt32() +
|
||||
" месяцев и более!");
|
||||
return false;
|
||||
}
|
||||
//-
|
||||
Dialog<Object, DirInfosFields> dialog = new Dialog<Object, DirInfosFields>(DirInfosFields.class) {
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 300;
|
||||
}
|
||||
@Override
|
||||
public int getDefaultWidth() {
|
||||
return 600;
|
||||
}
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
target.mountUI((JPanel) content);
|
||||
target.ShowUI();
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
}
|
||||
};
|
||||
if (dialog.ShowDialog("Найдено "+target.size()+" отчетов, не использовавшихся " +
|
||||
(Global.mainModule.getDb()).settings.get(SettingName.BugReportsAgeLimit).toInt32()+
|
||||
" месяцев и более. Удалить?")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (Global.mainModule.HasProject())
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (DirInfo dir : target.Data.values()) {
|
||||
ShowMessage1(dir.getPK().toString());
|
||||
Utils.forceDeleteWithCheck(dir.getFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
8
src/_VisualDVM/Passes/All/DeleteEnvironmentValue.java
Normal file
8
src/_VisualDVM/Passes/All/DeleteEnvironmentValue.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Passes.DeleteObjectPass;
|
||||
import _VisualDVM.GlobalData.EnvironmentValue.EnvironmentValue;
|
||||
public class DeleteEnvironmentValue extends DeleteObjectPass<EnvironmentValue> {
|
||||
public DeleteEnvironmentValue() {
|
||||
super(EnvironmentValue.class);
|
||||
}
|
||||
}
|
||||
39
src/_VisualDVM/Passes/All/DeleteFile.java
Normal file
39
src/_VisualDVM/Passes/All/DeleteFile.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.Passes.Project.ChangeFilePass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
public class DeleteFile extends ChangeFilePass<DBProjectFile> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
resetArgs();
|
||||
return (Global.mainModule.Check(Log, Current.SelectedFile)) &&
|
||||
UI_.Warning("Удалить файл "
|
||||
+ Utils_.Brackets((target = Global.mainModule.getSelectedFile()).name));
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (Global.mainModule.HasFile() && (Global.mainModule.getFile().file.equals(target.file)))
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentFile).Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(target.node);
|
||||
project.db.Delete(target);
|
||||
Utils.forceDeleteWithCheck(target.file);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Global.mainModule.set(Current.SelectedFile, null);
|
||||
Global.mainModule.set(Current.ProjectNode, null);
|
||||
}
|
||||
}
|
||||
10
src/_VisualDVM/Passes/All/DeleteGroup.java
Normal file
10
src/_VisualDVM/Passes/All/DeleteGroup.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.Passes.Server.DeleteServerObjects;
|
||||
public class DeleteGroup extends DeleteServerObjects<TestingServer, Group> {
|
||||
public DeleteGroup() {
|
||||
super(Global.testingServer, Group.class);
|
||||
}
|
||||
}
|
||||
25
src/_VisualDVM/Passes/All/DeleteLonelyM.java
Normal file
25
src/_VisualDVM/Passes/All/DeleteLonelyM.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DeleteLonelyM extends Pass<db_project_info> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Global.mainModule.Check(Log, Current.Root)) {
|
||||
target = Global.mainModule.getRoot();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Vector<db_project_info> targets = target.getLonelyM();
|
||||
for (db_project_info m : targets) {
|
||||
Global.mainModule.getPass(PassCode.DeleteVersion).Do(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
8
src/_VisualDVM/Passes/All/DeleteMachine.java
Normal file
8
src/_VisualDVM/Passes/All/DeleteMachine.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import Common.Passes.DeleteObjectPass;
|
||||
public class DeleteMachine extends DeleteObjectPass<Machine> {
|
||||
public DeleteMachine() {
|
||||
super(Machine.class);
|
||||
}
|
||||
}
|
||||
8
src/_VisualDVM/Passes/All/DeleteMakefile.java
Normal file
8
src/_VisualDVM/Passes/All/DeleteMakefile.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.GlobalData.Makefile.Makefile;
|
||||
import Common.Passes.DeleteObjectPass;
|
||||
public class DeleteMakefile extends DeleteObjectPass<Makefile> {
|
||||
public DeleteMakefile() {
|
||||
super(Makefile.class);
|
||||
}
|
||||
}
|
||||
8
src/_VisualDVM/Passes/All/DeleteProfile.java
Normal file
8
src/_VisualDVM/Passes/All/DeleteProfile.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
|
||||
import Common.Passes.DeleteObjectPass;
|
||||
public class DeleteProfile extends DeleteObjectPass<SapforProfile> {
|
||||
public DeleteProfile() {
|
||||
super(SapforProfile.class);
|
||||
}
|
||||
}
|
||||
8
src/_VisualDVM/Passes/All/DeleteRunConfiguration.java
Normal file
8
src/_VisualDVM/Passes/All/DeleteRunConfiguration.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.GlobalData.RunConfiguration.RunConfiguration;
|
||||
import Common.Passes.DeleteObjectPass;
|
||||
public class DeleteRunConfiguration extends DeleteObjectPass<RunConfiguration> {
|
||||
public DeleteRunConfiguration() {
|
||||
super(RunConfiguration.class);
|
||||
}
|
||||
}
|
||||
10
src/_VisualDVM/Passes/All/DeleteSapforConfiguration.java
Normal file
10
src/_VisualDVM/Passes/All/DeleteSapforConfiguration.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import _VisualDVM.Passes.Server.DeleteServerObjects;
|
||||
public class DeleteSapforConfiguration extends DeleteServerObjects<TestingServer, SapforConfiguration> {
|
||||
public DeleteSapforConfiguration() {
|
||||
super(Global.testingServer, SapforConfiguration.class);
|
||||
}
|
||||
}
|
||||
20
src/_VisualDVM/Passes/All/DeleteSapforPackage.java
Normal file
20
src/_VisualDVM/Passes/All/DeleteSapforPackage.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import _VisualDVM.Passes.Testing.DeleteTestingPackages;
|
||||
|
||||
import java.io.File;
|
||||
public class DeleteSapforPackage extends DeleteTestingPackages<SapforPackage> {
|
||||
public DeleteSapforPackage() {
|
||||
super(SapforPackage.class);
|
||||
}
|
||||
protected void showPreparation() throws Exception {
|
||||
super.showPreparation();
|
||||
UI.getMainWindow().getTestingWindow().DropSapforComparison();
|
||||
}
|
||||
@Override
|
||||
protected File getPackagesHome() {
|
||||
return Global.SapforPackagesDirectory;
|
||||
}
|
||||
}
|
||||
10
src/_VisualDVM/Passes/All/DeleteSapforSettings.java
Normal file
10
src/_VisualDVM/Passes/All/DeleteSapforSettings.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettings;
|
||||
import _VisualDVM.Passes.Server.DeleteServerObjects;
|
||||
public class DeleteSapforSettings extends DeleteServerObjects<TestingServer, SapforSettings> {
|
||||
public DeleteSapforSettings() {
|
||||
super(Global.testingServer, SapforSettings.class);
|
||||
}
|
||||
}
|
||||
10
src/_VisualDVM/Passes/All/DeleteSapforSettingsCommand.java
Normal file
10
src/_VisualDVM/Passes/All/DeleteSapforSettingsCommand.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;
|
||||
import _VisualDVM.Passes.Server.DeleteServerObjects;
|
||||
public class DeleteSapforSettingsCommand extends DeleteServerObjects<TestingServer, SapforSettingsCommand> {
|
||||
public DeleteSapforSettingsCommand() {
|
||||
super(Global.testingServer, SapforSettingsCommand.class);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user