рефакторинг команд ssh
v++ динамическая смена названия прохода Анализ Кода
This commit is contained in:
@@ -20,6 +20,7 @@ public class CheckAccount extends Pass_2021<Boolean> {
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
/*
|
||||
switch (Current.getAccount().email){
|
||||
case "vmk-post@yandex.ru":
|
||||
case "79854210702@ya.ru":
|
||||
@@ -42,14 +43,14 @@ public class CheckAccount extends Pass_2021<Boolean> {
|
||||
target = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
//временно. оффлайн проверка по почте
|
||||
/*
|
||||
|
||||
target = Current.getAccount().email.equals("?") ?
|
||||
(Pass_2021.passes.get(PassCode_2021.EditAccount).Do() &&
|
||||
Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do()) :
|
||||
(Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do());
|
||||
*/
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class RemoteSingleCommand extends CurrentConnectionPass<String> {
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
RemoteFile file = new RemoteFile(user.connection.sftpChannel.getHome(), Utils.getDateName("out"));
|
||||
user.connection.ShellCommand(command + " 1>" + Utils.DQuotes(file.full_name));
|
||||
user.connection.Command(command + " 1>" + Utils.DQuotes(file.full_name));
|
||||
if (user.connection.Exists(file)) {
|
||||
target = user.connection.readFromFile(file);
|
||||
user.connection.sftpChannel.rm(file.full_name);
|
||||
|
||||
@@ -3,6 +3,7 @@ import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import GlobalData.Settings.SettingName;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import Visual_DVM_2021.Passes.SapforAnalysis;
|
||||
public class SPF_GetArrayDistribution extends SPF_GetArrayDistributionOnlyAnalysis {
|
||||
@Override
|
||||
@@ -36,4 +37,8 @@ public class SPF_GetArrayDistribution extends SPF_GetArrayDistributionOnlyAnalys
|
||||
}
|
||||
return super.canStart(args);
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return code().getDescription();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.UI.Menus_2023.PassControl;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Index;
|
||||
import GlobalData.Settings.SettingName;
|
||||
import ProjectData.SapforData.Regions.ParallelRegion;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.SapforAnalysis;
|
||||
@@ -67,4 +70,13 @@ public class SPF_GetArrayDistributionOnlyAnalysis extends SapforAnalysis {
|
||||
UI.getMainWindow().FocusProject();
|
||||
UI.getMainWindow().getProjectWindow().FocusAnalysis();
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return Global.db.settings.get(SettingName.MPI_PROGRAM).toBoolean()?
|
||||
"Анализ кода (общая память)":"Анализ кода";
|
||||
}
|
||||
public void RefreshControls(){
|
||||
for (PassControl control: controls)
|
||||
control.setText(getDescription());
|
||||
}
|
||||
}
|
||||
@@ -1,58 +1,14 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Utils.Utils;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.Date;
|
||||
public class TestPass extends Pass_2021 {
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.SSH.CurrentConnectionPass;
|
||||
public class TestPass extends CurrentConnectionPass {
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return super.needsAnimation();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
File file = Utils.getTempFileName("table");
|
||||
//--
|
||||
Workbook book = new HSSFWorkbook();
|
||||
Sheet sheet = book.createSheet("Birthdays");
|
||||
|
||||
// Нумерация начинается с нуля
|
||||
Row row = sheet.createRow(0);
|
||||
|
||||
// Мы запишем имя и дату в два столбца
|
||||
// имя будет String, а дата рождения --- Date,
|
||||
// формата dd.mm.yyyy
|
||||
Cell name = row.createCell(0);
|
||||
name.setCellValue("John");
|
||||
|
||||
Cell birthdate = row.createCell(1);
|
||||
|
||||
DataFormat format = book.createDataFormat();
|
||||
CellStyle dateStyle = book.createCellStyle();
|
||||
dateStyle.setDataFormat(format.getFormat("dd.mm.yyyy"));
|
||||
birthdate.setCellStyle(dateStyle);
|
||||
|
||||
|
||||
// Нумерация лет начинается с 1900-го
|
||||
birthdate.setCellValue(new Date(110, 10, 10));
|
||||
|
||||
// Меняем размер столбца
|
||||
sheet.autoSizeColumn(1);
|
||||
|
||||
// Записываем всё в файл
|
||||
FileOutputStream stream = new FileOutputStream(file);
|
||||
book.write(stream);
|
||||
book.close();
|
||||
stream.close();
|
||||
///--
|
||||
File res = new File("kek.xls");
|
||||
FileUtils.copyFile(file, res);
|
||||
book= null;
|
||||
stream = null;
|
||||
file = null;
|
||||
protected void ServerAction() throws Exception {
|
||||
String dir = "/home/testuser/jack sparrow/";
|
||||
String command = "rm -rf " + Utils.DQuotes(dir);
|
||||
if (!dir.isEmpty() && !dir.equals("/") && !dir.equals("\\") && !dir.equals("*")) {
|
||||
user.connection.Command(command);
|
||||
} else throw new PassException("Недопустимый путь для удаления папки " + Utils.DQuotes(dir));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,8 @@ public class UpdateSetting extends Pass_2021<DBSetting> {
|
||||
break;
|
||||
case MPI_PROGRAM:
|
||||
Pass_2021.passes.get(PassCode_2021.CleanAnalyses).Do();
|
||||
((SPF_GetArrayDistributionOnlyAnalysis)
|
||||
Pass_2021.passes.get(PassCode_2021.SPF_GetArrayDistributionOnlyAnalysis)).RefreshControls();
|
||||
break;
|
||||
case SmallScreen:
|
||||
boolean small = target.toBoolean();
|
||||
|
||||
@@ -378,7 +378,7 @@ public enum PassCode_2021 {
|
||||
case AddTasksToSapforPackage:
|
||||
return "Добавить задачи в пакет SAPFOR";
|
||||
case SPF_InsertPrivateFromGUI:
|
||||
return "Вставка директив для нераспределяемых массивов";
|
||||
return "Вставка директив приватизации";
|
||||
case CreateTestFromSelectedFiles:
|
||||
return "Создать тест из выделенных файлов";
|
||||
case DownloadSapforPackage:
|
||||
|
||||
Reference in New Issue
Block a user