рефакторинг. переносил текущие объекты в другое место

This commit is contained in:
2024-10-13 22:08:13 +03:00
parent 09b64218bd
commit 6afa2dc892
240 changed files with 1472 additions and 1518 deletions

View File

@@ -70,7 +70,7 @@ public class BugReport extends rDBObject {
date = new Date().getTime();
change_date = new Date().getTime();
state = BugReportState.draft;
owner = Current.getProject().Home;
owner = Global.mainModule.getProject().Home;
}
@Override
public boolean isVisible() {

View File

@@ -29,8 +29,8 @@ public class BugReportInterface {
&& object.project_version.toUpperCase().contains(filterVersion.toUpperCase())
&& (!filterOpenedOnly || object.state.equals(BugReportState.active))
&& (!filterMyOnly ||
(object.sender_address.equalsIgnoreCase(Current.getAccount().email) ||
object.executor_address.equalsIgnoreCase(Current.getAccount().email)
(object.sender_address.equalsIgnoreCase(Global.mainModule.getAccount().email) ||
object.executor_address.equalsIgnoreCase(Global.mainModule.getAccount().email)
)
);
}
@@ -69,12 +69,12 @@ public class BugReportInterface {
for (String a : data)
if (a.length() > 0)
res.add(a);
if (!res.contains(Current.getAccount().email))
res.add(Current.getAccount().email);
if (!res.contains(Global.mainModule.getAccount().email))
res.add(Global.mainModule.getAccount().email);
return res;
}
public static File[] getAttachements(BugReport object) {
File[] project_attachements = Current.getProject().getAttachmentsDirectory().listFiles();
File[] project_attachements = Global.mainModule.getProject().getAttachmentsDirectory().listFiles();
File[] res = new File[project_attachements.length + 1];
res[0] = getArchiveFile(object);
for (int i = 0; i < project_attachements.length; ++i)
@@ -97,7 +97,7 @@ public class BugReportInterface {
}
public static String getSettingsSummary(BugReport object) {
return
(Current.HasAccount() ? (Current.getAccount().isAdmin() ? ("Адрес отправителя: " + object.sender_address + "\n") : "") : "") +
(Global.mainModule.HasAccount() ? (Global.mainModule.getAccount().isAdmin() ? ("Адрес отправителя: " + object.sender_address + "\n") : "") : "") +
"Версия SAPFOR: " + object.sapfor_version + "\n" +
"Версия визуализатора: " + object.visualiser_version + "\n" +
"----------------------------------\n" +

View File

@@ -72,7 +72,7 @@ public class PerformanceAnalyzer extends Component {
}
public void ConvertStatistic() throws Exception {
message_in = (MessageJtoJ) in.readObject();
String message = Current.getSapfor().readStatForAnalyzer(message_in.getMessage());
String message = Global.mainModule.getSapfor().readStatForAnalyzer(message_in.getMessage());
message_out = new MessageJtoJ(message, message_in.getCommand());
out.writeObject(message_out);
}
@@ -117,7 +117,7 @@ public class PerformanceAnalyzer extends Component {
try {
StartServer(() -> {
SendMessageOut(new MessageJtoJ(
Current.HasProject() ? Current.getProject().getAnalyzerDirectory().getAbsolutePath() : Global.PerformanceAnalyzerDirectory.getAbsolutePath(), "StatDirPath"));
Global.mainModule.HasProject() ? Global.mainModule.getProject().getAnalyzerDirectory().getAbsolutePath() : Global.PerformanceAnalyzerDirectory.getAbsolutePath(), "StatDirPath"));
while (true) ConvertStatistic();
});
// UI.Info(String.valueOf(getPort()));

View File

@@ -1,6 +1,7 @@
package _VisualDVM.Repository.Component.Sapfor;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -28,8 +29,8 @@ public class MessagesServer {
InputStreamReader(client.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
if (Current.HasPassForm())
Current.getPassForm().Result.ShowSapforMessage(line);
if (Global.mainModule.HasPassForm())
Global.mainModule.getPassForm().Result.ShowSapforMessage(line);
}
} catch (Exception ex) {
// UI.Print(DebugPrintLevel.MessagesServer, "соединение сброшено!");

View File

@@ -311,18 +311,18 @@ public abstract class Sapfor extends OSDComponent {
//todo рефакторить. отвязать от текущего проекта.
public void UpdateProjectFiles(boolean mode) throws Exception {
ResetAllAnalyses();
Current.getProject().dropLastModification();
Global.mainModule.getProject().dropLastModification();
DBProjectFile cuf = null;
if (Current.HasFile()) {
cuf = Current.getFile();
if (Global.mainModule.HasFile()) {
cuf = Global.mainModule.getFile();
Pass.passes.get(PassCode.CloseCurrentFile).Do();
}
if (mode) //модификация
{
OldFiles.clear();
for (String name : ModifiedFiles.keySet()) {
if (Current.getProject().db.files.Data.containsKey(name)) {
File file = Current.getProject().db.files.Data.get(name).file;
if (Global.mainModule.getProject().db.files.Data.containsKey(name)) {
File file = Global.mainModule.getProject().db.files.Data.get(name).file;
OldFiles.put(name, Utils.ReadAllText(file));
Utils.WriteToFile(file, ModifiedFiles.get(name));
}
@@ -332,7 +332,7 @@ public abstract class Sapfor extends OSDComponent {
{
if (OldFiles.size() > 0) {
for (String name : OldFiles.keySet()) {
File file = Current.getProject().db.files.Data.get(name).file;
File file = Global.mainModule.getProject().db.files.Data.get(name).file;
Utils.WriteToFile(file, OldFiles.get(name));
}
OldFiles.clear();

View File

@@ -1,6 +1,7 @@
package _VisualDVM.Repository.SubscriberWorkspace;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Global;
public class SubscriberWorkspace extends iDBObject {
public String email; //почта
public String URL; //адрес:порт машины
@@ -8,9 +9,9 @@ public class SubscriberWorkspace extends iDBObject {
public String path; //рабочая папка на машине
@Override
public boolean isVisible() {
return Current.HasSubscriber()&&
Current.getSubscriber().address.equals(email)&&
(Current.getAccount().isAdmin() || Current.getAccount().email.equals(Current.getSubscriber().address));
return Global.mainModule.HasSubscriber()&&
Global.mainModule.getSubscriber().address.equals(email)&&
(Global.mainModule.getAccount().isAdmin() || Global.mainModule.getAccount().email.equals(Global.mainModule.getSubscriber().address));
}
//-

View File

@@ -7,6 +7,7 @@ import Common.Database.Tables.DBTable;
import Common.Database.Tables.FKBehaviour;
import Common.Database.Tables.FKCurrentObjectBehaviuor;
import Common.Database.Tables.FKDataBehaviour;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Account.AccountRole;
import _VisualDVM.Repository.SubscriberWorkspace.SubscriberWorkspace;
import _VisualDVM.Repository.Subscribes.UI.SubscriberFields;
@@ -30,9 +31,9 @@ public class SubsribersDBTable extends DBTable<String, Subscriber> {
}
@Override
protected void AdditionalInitColumns() {
boolean admin = Current.getAccount().role.equals(AccountRole.Admin);
boolean admin = Global.mainModule.getAccount().role.equals(AccountRole.Admin);
columns.get(0).setVisible(admin);
columns.get(1).setVisible(Current.getBugReport() != null);
columns.get(1).setVisible(Global.mainModule.getBugReport() != null);
columns.get(3).setVisible(admin);
columns.get(4).setVisible(admin);
}