промежуточный. улучшение удаления баг репортов, в процессе отображения диалогового окна
This commit is contained in:
14
.idea/workspace.xml
generated
14
.idea/workspace.xml
generated
@@ -7,10 +7,18 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/bug_1723053809" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/src/GlobalData/FileObject/FileObject.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/bug_1723053818" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/src/GlobalData/FileObject/FileObjectsDataSet.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/GlobalData/FileObject/FileObjectsFields.form" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/GlobalData/FileObject/FileObjectsFields.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/GetOldBugReports.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/ProjectData/Files/DBProjectFile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ProjectData/Files/DBProjectFile.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Common/UI/Menus_2023/MainMenuBar/MainMenuBar.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/Menus_2023/MainMenuBar/MainMenuBar.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ArchivesBackupPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ArchivesBackupPass.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteDownloadedBugReports.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteDownloadedBugReports.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/TestPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/TestPass.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class MainMenuBar extends VisualiserMenuBar {
|
|||||||
//-
|
//-
|
||||||
setPreferredSize(new Dimension(0, 30));
|
setPreferredSize(new Dimension(0, 30));
|
||||||
//---
|
//---
|
||||||
/*
|
|
||||||
add(new MenuBarButton() {
|
add(new MenuBarButton() {
|
||||||
{
|
{
|
||||||
setIcon("/icons/Apply.png");
|
setIcon("/icons/Apply.png");
|
||||||
@@ -65,7 +65,6 @@ public class MainMenuBar extends VisualiserMenuBar {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
ShowProject(false);
|
ShowProject(false);
|
||||||
}
|
}
|
||||||
public void ShowUpdatesIcon() {
|
public void ShowUpdatesIcon() {
|
||||||
|
|||||||
@@ -1249,5 +1249,42 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//--
|
||||||
|
private static void get_newest_file_date_r(File dir, Vector<Long> dates){
|
||||||
|
Vector<File> files= new Vector(Arrays.asList(dir.listFiles(new FileFilter() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(File pathname) {
|
||||||
|
return pathname.isFile();
|
||||||
|
}
|
||||||
|
})));
|
||||||
|
if (!files.isEmpty()) {
|
||||||
|
files.sort(new Comparator<File>() {
|
||||||
|
@Override
|
||||||
|
public int compare(File o1, File o2) {
|
||||||
|
return Long.compare(o1.lastModified(), o2.lastModified());
|
||||||
|
}
|
||||||
|
}.reversed());
|
||||||
|
dates.add(files.firstElement().lastModified());
|
||||||
|
}
|
||||||
|
//--
|
||||||
|
Vector<File> subdirs= new Vector(Arrays.asList(dir.listFiles(new FileFilter() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(File pathname) {
|
||||||
|
return pathname.isDirectory();
|
||||||
|
}
|
||||||
|
})));
|
||||||
|
if (!subdirs.isEmpty()){
|
||||||
|
for (File subdir: subdirs)
|
||||||
|
get_newest_file_date_r(subdir, dates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static long getNewestFileDate(File dir){
|
||||||
|
Vector<Long> dates = new Vector<>();
|
||||||
|
dates.add(dir.lastModified());
|
||||||
|
get_newest_file_date_r(dir, dates);
|
||||||
|
Collections.sort(dates);
|
||||||
|
System.out.println(new Date(dates.lastElement()));
|
||||||
|
return dates.firstElement();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
src/GlobalData/FileObject/FileObject.java
Normal file
18
src/GlobalData/FileObject/FileObject.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package GlobalData.FileObject;
|
||||||
|
import Common.Database.DBObject;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Date;
|
||||||
|
public class FileObject extends DBObject {
|
||||||
|
File file;
|
||||||
|
public FileObject(File file_in){
|
||||||
|
file=file;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Object getPK() {
|
||||||
|
return file.getName();
|
||||||
|
}
|
||||||
|
public Date getDate(){
|
||||||
|
return new Date(file.lastModified());
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/GlobalData/FileObject/FileObjectsDataSet.java
Normal file
34
src/GlobalData/FileObject/FileObjectsDataSet.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package GlobalData.FileObject;
|
||||||
|
import Common.Database.DataSet;
|
||||||
|
import Common.UI.DataSetControlForm;
|
||||||
|
import GlobalData.Machine.Machine;
|
||||||
|
|
||||||
|
import static Common.UI.Tables.TableRenderers.*;
|
||||||
|
public class FileObjectsDataSet extends DataSet<String, FileObject> {
|
||||||
|
public FileObjectsDataSet() {
|
||||||
|
super(String.class, FileObject.class);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected DataSetControlForm createUI() {
|
||||||
|
return new DataSetControlForm(this){
|
||||||
|
@Override
|
||||||
|
protected void AdditionalInitColumns() {
|
||||||
|
// columns.get(1).setRenderer(RendererDate);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] getUIColumnNames(){
|
||||||
|
return new String[]{
|
||||||
|
"дата изменения"};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Object getFieldAt(FileObject object, int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 1:
|
||||||
|
return object.file.getName();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/GlobalData/FileObject/FileObjectsFields.form
Normal file
11
src/GlobalData/FileObject/FileObjectsFields.form
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="GlobalData.FileObject.FileObjectsFields">
|
||||||
|
<grid id="27dc6" binding="content" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||||
|
<constraints>
|
||||||
|
<xy x="20" y="20" width="500" height="400"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children/>
|
||||||
|
</grid>
|
||||||
|
</form>
|
||||||
12
src/GlobalData/FileObject/FileObjectsFields.java
Normal file
12
src/GlobalData/FileObject/FileObjectsFields.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package GlobalData.FileObject;
|
||||||
|
import Common.UI.Windows.Dialog.DialogFields;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
public class FileObjectsFields implements DialogFields {
|
||||||
|
public JPanel content;
|
||||||
|
@Override
|
||||||
|
public Component getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import com.jcraft.jsch.ChannelSftp;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class ArchivesBackupPass extends ConnectionPass<File> {
|
public class ArchivesBackupPass extends ConnectionPass<File> {
|
||||||
File src;
|
File src;
|
||||||
@@ -37,7 +38,13 @@ public class ArchivesBackupPass extends ConnectionPass<File> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//сортируем по времени обновления. по убыванию.
|
//сортируем по времени обновления. по убыванию.
|
||||||
files.sort((o1, o2) -> (int) (o2.updateTime - o1.updateTime));
|
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) {
|
for (int i = 2; i < files.size(); ++i) {
|
||||||
user.connection.sftpChannel.rm(files.get(i).full_name);
|
user.connection.sftpChannel.rm(files.get(i).full_name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,19 @@ package Visual_DVM_2021.Passes.All;
|
|||||||
import Common.Current;
|
import Common.Current;
|
||||||
import Common.Global;
|
import Common.Global;
|
||||||
import Common.UI.UI;
|
import Common.UI.UI;
|
||||||
|
import Common.UI.Windows.Dialog.Dialog;
|
||||||
import Common.Utils.Utils;
|
import Common.Utils.Utils;
|
||||||
|
import GlobalData.FileObject.FileObject;
|
||||||
|
import GlobalData.FileObject.FileObjectsDataSet;
|
||||||
|
import GlobalData.FileObject.FileObjectsFields;
|
||||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||||
import Visual_DVM_2021.Passes.Pass_2021;
|
import Visual_DVM_2021.Passes.Pass_2021;
|
||||||
|
import Visual_DVM_2021.Passes.UI.CopyProjectFields;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.nio.file.Paths;
|
||||||
import java.util.Vector;
|
import java.util.*;
|
||||||
public class DeleteDownloadedBugReports extends Pass_2021<Vector<File>> {
|
public class DeleteDownloadedBugReports extends Pass_2021<Vector<File>> {
|
||||||
@Override
|
@Override
|
||||||
protected boolean needsAnimation() {
|
protected boolean needsAnimation() {
|
||||||
@@ -21,26 +27,73 @@ public class DeleteDownloadedBugReports extends Pass_2021<Vector<File>> {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean canStart(Object... args) throws Exception {
|
protected boolean canStart(Object... args) throws Exception {
|
||||||
target = null;
|
target = null;
|
||||||
|
if (passes.get(PassCode_2021.GetOldBugReports).Do()){
|
||||||
|
target = (Vector<File>) passes.get(PassCode_2021.GetOldBugReports).target;
|
||||||
|
FileObjectsDataSet set = new FileObjectsDataSet();
|
||||||
|
for (File file: target){
|
||||||
|
set.put(file.getName(),new FileObject(file));
|
||||||
|
}
|
||||||
|
//-
|
||||||
|
Dialog<Object, FileObjectsFields> dialog = new Dialog<Object, FileObjectsFields>(FileObjectsFields.class) {
|
||||||
|
@Override
|
||||||
|
public int getDefaultHeight() {
|
||||||
|
return 230;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void Init(Object... params) {
|
||||||
|
set.mountUI((JPanel) content);
|
||||||
|
set.ShowUI();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void validateFields() {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (dialog.ShowDialog("Найдено "+target.size()+" загруженных баг-репортов, не использовавшихся 2 месяца и более. Удалить их?")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
else return false;
|
||||||
|
|
||||||
|
|
||||||
File workspace = Global.visualiser.getWorkspace();
|
File workspace = Global.visualiser.getWorkspace();
|
||||||
File[] files = workspace.listFiles(pathname -> pathname.isDirectory() && pathname.getName().toLowerCase().startsWith("bugreport_"));
|
File[] files = workspace.listFiles(pathname -> pathname.isDirectory() && pathname.getName().toLowerCase().startsWith("bugreport_"));
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
target = new Vector<>(Arrays.asList(files));
|
target = new Vector<>(Arrays.asList(files));
|
||||||
return UI.Warning("Будет удалено " + target.size() + " скачанных отчётов об ошибках." +
|
//---
|
||||||
(Current.HasProject() ? "(Текущий проект будет закрыт)" : "")
|
Calendar c = new GregorianCalendar();
|
||||||
);
|
c.setTimeInMillis(System.currentTimeMillis());
|
||||||
|
c.add(Calendar.MONTH, -2);
|
||||||
|
Date date = c.getTime();
|
||||||
|
System.out.println(date);
|
||||||
|
|
||||||
|
|
||||||
|
//---
|
||||||
|
return false;
|
||||||
|
//---
|
||||||
|
// return UI.Warning("Будет удалено " + target.size() + " скачанных отчётов об ошибках." +
|
||||||
|
// (Current.HasProject() ? "(Текущий проект будет закрыт)" : "")
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void performPreparation() throws Exception {
|
protected void performPreparation() throws Exception {
|
||||||
|
/*
|
||||||
if (Current.HasProject())
|
if (Current.HasProject())
|
||||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void body() throws Exception {
|
protected void body() throws Exception {
|
||||||
|
/*
|
||||||
for (File file : target) {
|
for (File file : target) {
|
||||||
ShowMessage1(file.getAbsolutePath());
|
ShowMessage1(file.getAbsolutePath());
|
||||||
Utils.forceDeleteWithCheck(file);
|
Utils.forceDeleteWithCheck(file);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
UI.Info("+");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
41
src/Visual_DVM_2021/Passes/All/GetOldBugReports.java
Normal file
41
src/Visual_DVM_2021/Passes/All/GetOldBugReports.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package Visual_DVM_2021.Passes.All;
|
||||||
|
import Common.Global;
|
||||||
|
import Common.Utils.Utils;
|
||||||
|
import Visual_DVM_2021.Passes.Pass_2021;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.*;
|
||||||
|
public class GetOldBugReports extends Pass_2021<Vector<File>> {
|
||||||
|
@Override
|
||||||
|
protected boolean canStart(Object... args) throws Exception {
|
||||||
|
target = new Vector<>();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected boolean needsAnimation() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void body() throws Exception {
|
||||||
|
File workspace = Global.visualiser.getWorkspace();
|
||||||
|
File[] files = workspace.listFiles(pathname -> pathname.isDirectory() && pathname.getName().toLowerCase().startsWith("bugreport_"));
|
||||||
|
if (files != null) {
|
||||||
|
//---
|
||||||
|
Calendar c = new GregorianCalendar();
|
||||||
|
c.setTimeInMillis(System.currentTimeMillis());
|
||||||
|
c.add(Calendar.MONTH, -2);
|
||||||
|
Date date = c.getTime();
|
||||||
|
System.out.println(date);
|
||||||
|
long border = date.getTime();
|
||||||
|
//--
|
||||||
|
for (File file: files){
|
||||||
|
ShowMessage2(file.getName());
|
||||||
|
long mdate = Utils.getNewestFileDate(file);
|
||||||
|
if (mdate<=border){
|
||||||
|
target.add(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
package Visual_DVM_2021.Passes.All;
|
package Visual_DVM_2021.Passes.All;
|
||||||
import Repository.Server.ServerCode;
|
import Common.Utils.Utils;
|
||||||
import Repository.Server.ServerExchangeUnit_2021;
|
import Visual_DVM_2021.Passes.Pass_2021;
|
||||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
|
||||||
public class TestPass extends TestingSystemPass {
|
import java.io.File;
|
||||||
|
public class TestPass extends Pass_2021<File> {
|
||||||
@Override
|
@Override
|
||||||
protected void ServerAction() throws Exception {
|
protected void body() throws Exception {
|
||||||
// Command(new ServerExchangeUnit_2021(ServerCode.GetSapforActualVersion));
|
//определить дату изменения проекта.
|
||||||
|
target = new File("E:\\Tests\\bugreport_1712090719\\SP");
|
||||||
|
Utils.getNewestFileDate(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,12 +340,15 @@ public enum PassCode_2021 {
|
|||||||
ShowTestingServerFile,
|
ShowTestingServerFile,
|
||||||
//--
|
//--
|
||||||
ShowSapforCompilationOut,
|
ShowSapforCompilationOut,
|
||||||
ShowSapforCompilationErr;
|
ShowSapforCompilationErr,
|
||||||
|
GetOldBugReports;
|
||||||
//--
|
//--
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case Undefined:
|
case Undefined:
|
||||||
return "?";
|
return "?";
|
||||||
|
case GetOldBugReports:
|
||||||
|
return "Получить неиспользуемые баг репорты";
|
||||||
case SPF_RenameIncludes:
|
case SPF_RenameIncludes:
|
||||||
return "Переименование заголовочных файлов";
|
return "Переименование заголовочных файлов";
|
||||||
case ShowSapforCompilationOut:
|
case ShowSapforCompilationOut:
|
||||||
|
|||||||
Reference in New Issue
Block a user