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

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

@@ -203,234 +203,4 @@ public enum Current implements Current_ {
return "";
}
}
//------------------------------------------------------------------------------------->>
public static boolean HasProject() {
return Current_.get(Project) != null;
}
public static boolean HasFile() {
return Current_.get(File) != null;
}
public static boolean HasSelectedFile() {
return Current_.get(SelectedFile) != null;
}
public static boolean HasAccount() {
return Current_.get(Account) != null;
}
public static boolean HasMachine() {
return Current_.get(Machine) != null;
}
public static boolean HasUser() {
return Current_.get(User) != null;
}
public static boolean HasCompiler() {
return Current_.get(Compiler) != null;
}
public static boolean HasRemoteFile() {
return Current_.get(RemoteFile) != null;
}
public static boolean HasMakefile() {
return Current_.get(Makefile) != null;
}
public static boolean HasRunConfiguration() {
return Current_.get(RunConfiguration) != null;
}
public static boolean HasCompilationTask() {
return Current_.get(CompilationTask) != null;
}
public static boolean HasRunTask() {
return Current_.get(RunTask) != null;
}
public static boolean HasPassForm() {
return Current_.get(PassForm) != null;
}
public static boolean HasProjectView() {
return Current_.get(ProjectView) != null;
}
public static SapforSettings getSapforSettings() {
return (SapforSettings) Current_.get(SapforSettings);
}
public static boolean HasSapforSettings() {
return Current_.get(SapforSettings) != null;
}
public static db_project_info getProject() {
return (db_project_info) Current_.get(Project);
}
public static DBProjectFile getFile() {
return (DBProjectFile) Current_.get(File);
}
public static _VisualDVM.Repository.Component.Component getComponent() {
return (_VisualDVM.Repository.Component.Component) Current_.get(Component);
}
public static _VisualDVM.Repository.BugReport.BugReport getBugReport() {
return (BugReport) Current_.get(BugReport);
}
public static db_project_info getRoot() {
return (db_project_info) Current_.get(Root);
}
public static boolean HasRoot() {
return Current_.get(Root) != null;
}
public static db_project_info getVersion() {
return (db_project_info) Current_.get(Version);
}
public static Account getAccount() {
return (Account) Current_.get(Account);
}
public static boolean HasSubscriber() {
return Current_.get(Current.Subscriber) != null;
}
public static _VisualDVM.Repository.Subscribes.Subscriber getSubscriber() {
return (Subscriber) Current_.get(Current.Subscriber);
}
public static Machine getMachine() {
return (Machine) Current_.get(Current.Machine);
}
public static User getUser() {
return (User) Current_.get(Current.User);
}
public static Compiler getCompiler() {
return (Compiler) Current_.get(Current.Compiler);
}
public static CompilationTask getCompilationTask() {
return (CompilationTask) Current_.get(Current.CompilationTask);
}
public static RunTask getRunTask() {
return (RunTask) Current_.get(Current.RunTask);
}
public static RemoteFile getRemoteFile() {
return (RemoteFile) Current_.get(Current.RemoteFile);
}
public static Makefile getMakefile() {
return (Makefile) Current_.get(Current.Makefile);
}
public static Module getModule() {
return (Module) Current_.get(Current.Module);
}
public static RunConfiguration getRunConfiguration() {
return (RunConfiguration) Current_.get(Current.RunConfiguration);
}
public static _VisualDVM.Repository.Component.Sapfor.Sapfor getSapfor() {
return (_VisualDVM.Repository.Component.Sapfor.Sapfor) Current_.get(Current.Sapfor);
}
public static boolean HasGroup() {
return Current_.get(Current.Group) != null;
}
public static _VisualDVM.TestingSystem.Common.Group.Group getGroup() {
return (_VisualDVM.TestingSystem.Common.Group.Group) Current_.get(Current.Group);
}
public static boolean HasConfiguration() {
return Current_.get(Current.DVMConfiguration) != null;
}
public static DVMConfiguration getDVMConfiguration() {
return (DVMConfiguration) Current_.get(Current.DVMConfiguration);
}
public static SapforConfiguration getSapforConfiguration() {
return (_VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration) Current_.get(Current.SapforConfiguration);
}
public static Test getTest() {
return (_VisualDVM.TestingSystem.Common.Test.Test) Current_.get(Current.Test);
}
public static boolean HasTest() {
return Current_.get(Current.Test) != null;
}
public static boolean HasVersion() {
return Current_.get(Current.Version) != null;
}
public static RemoteFile getComponentServerBackup() {
return (RemoteFile) Current_.get(Current.ComponentServerBackup);
}
public static boolean HasComponentServerBackup() {
return Current_.get(Current.ComponentServerBackup) != null;
}
public static DefaultMutableTreeNode getProjectNode() {
return (DefaultMutableTreeNode) Current_.get(Current.ProjectNode);
}
public static DefaultMutableTreeNode getProjectCurrentParentNode() {
DefaultMutableTreeNode node = Current.getProjectNode();
//если в дереве еще никто не выделялся, берем корень.
if (node == null)
return Current.getProject().filesTreeRoot;
return (node.getUserObject() instanceof DBProjectFile) ? (DefaultMutableTreeNode) node.getParent() : node;
}
public static File getSelectedDirectory() {
return (File) Current_.get(Current.SelectedDirectory);
}
public static DBProjectFile getSelectedFile() {
return (DBProjectFile) Current_.get(Current.SelectedFile);
}
public static boolean HasBugReport() {
return Current_.get(Current.BugReport) != null;
}
public static PassForm getPassForm() {
return (Visual_DVM_2021.Passes.UI.PassForm) Current_.get(Current.PassForm);
}
public static ParallelRegion getParallelRegion() {
return (ParallelRegion) Current_.get(Current.ParallelRegion);
}
public static boolean HasParallelRegion() {
return Current_.get(Current.ParallelRegion) != null;
}
public static boolean HasFunction() {
return Current_.get(Current.Function) != null;
}
public static boolean HasSelectedFunction() {
return Current_.get(Current.SelectedFunction) != null;
}
public static FuncInfo getFunction() {
return (FuncInfo) Current_.get(Current.Function);
}
public static FuncInfo getSelectionFunction() {
return (FuncInfo) Current_.get(Current.SelectedFunction);
}
public static boolean HasScenario() {
return Current_.get(Current.Scenario) != null;
}
public static db_project_info getPackageVersion() {
return (db_project_info) Current_.get(Current.PackageVersion);
}
public static boolean HasPackageVersion() {
return Current_.get(Current.PackageVersion) != null;
}
public static boolean HasSapforConfiguration() {
return Current_.get(Current.SapforConfiguration) != null;
}
public static _VisualDVM.ProjectData.ProjectView getProjectView() {
return (_VisualDVM.ProjectData.ProjectView) Current_.get(ProjectView);
}
public static boolean HasSapforProfile() {
return Current_.get(Current.SapforProfile) != null;
}
public static _VisualDVM.GlobalData.SapforProfile.SapforProfile getSapforProfile() {
return (_VisualDVM.GlobalData.SapforProfile.SapforProfile) Current_.get(Current.SapforProfile);
}
public static boolean HasServerSapfor() {
return Current_.get(Current.ServerSapfor) != null;
}
public static _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapfor getServerSapfor() {
return (_VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapfor) Current_.get(Current.ServerSapfor);
}
public static boolean HasSubscriberWorkspace() {
return Current_.get(Current.SubscriberWorkspace) != null;
}
public static _VisualDVM.Repository.SubscriberWorkspace.SubscriberWorkspace getSubscriberWorkspace() {
return (_VisualDVM.Repository.SubscriberWorkspace.SubscriberWorkspace) Current_.get(Current.SubscriberWorkspace);
}
public static boolean HasDVMPackage() {
return Current_.get(Current.DVMPackage) != null;
}
public static _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage getDVMPackage() {
return (_VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage) Current_.get(Current.DVMPackage);
}
public static boolean HasSapforPackage() {
return Current_.get(Current.SapforPackage) != null;
}
public static _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage getSapforPackage() {
return (_VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage) Current_.get(Current.SapforPackage);
}
public static boolean HasDVMRunTask() {
return Current_.get(Current.DVMRunTask) != null;
}
public static _VisualDVM.TestingSystem.DVM.DVMTasks.DVMRunTask getDVMRunTask() {
return (_VisualDVM.TestingSystem.DVM.DVMTasks.DVMRunTask) Current_.get(Current.DVMRunTask);
}
}

View File

@@ -1,5 +1,4 @@
package _VisualDVM;
import Common.Current_;
import Common.Database.Tables.DataSet;
import Common.Mode;
import Common.Passes.Pass;
@@ -9,7 +8,6 @@ import Common.Visual.UI_;
import Visual_DVM_2021.Passes.PassCode;
import _VisualDVM.GlobalData.Account.Account;
import _VisualDVM.GlobalData.Account.AccountRole;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.GlobalData.Settings.DBSetting;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.ProjectData.ProjectView;
@@ -155,7 +153,6 @@ public class Global {
//-
public static void FinishApplication() {
try {
// if (Utils_.db != null) Utils_.db.Disconnect();
mainModule.DeactivateDB();
if (componentsServer.db != null)
componentsServer.db.Disconnect();
@@ -228,8 +225,6 @@ public class Global {
//--
public static void NormalMode(int port) throws Exception {
mainModule= new MainModule();
//-------------------------------->>
//-------------------------------->>
UI_.active = true;
UI_.setTheme(new LightSPFEditorTheme());
@@ -254,9 +249,9 @@ public class Global {
//единственное меню до остальных.
UI_.menuBars.put(ComponentsSet.class, new ComponentsMenuBar());
Components = new ComponentsSet();
Current_.set(Current.ProjectView, ProjectView.Files);
mainModule.set(Current.ProjectView, ProjectView.Files);
Components.put(ComponentType.Visualiser, visualiser = new Visualiser());
Components.put(ComponentType.Sapfor_F, (Component) Current_.set(Current.Sapfor, new Sapfor_F()));
Components.put(ComponentType.Sapfor_F, (Component) mainModule.set(Current.Sapfor, new Sapfor_F()));
Components.put(ComponentType.Visualizer_2, visualizer_2);
Components.put(ComponentType.PerformanceAnalyzer, performanceAnalyzer = new PerformanceAnalyzer());
Components.put(ComponentType.Instruction, new Instruction());
@@ -288,11 +283,8 @@ public class Global {
}
} while (flag);
}
//---
mainModule.ActivateDB();
// ActivateDB(); //тут current getAccount; роль по умолчанию всегда неизвестна.
///--------------
Current_.set(Current.Account, new Account() {
mainModule.set(Current.Account, new Account() {
{
name = "M";
email = "vmk-post@yandex.ru";
@@ -311,14 +303,13 @@ public class Global {
if (mainModule.getDb().settings.get(SettingName.AutoTestsLoad).toBoolean())
Pass.passes.get(PassCode.SynchronizeTests).Do();
Pass.CheckAllStats();
Current.getSapfor().refreshPid(); //без сапфора сюда это все равно не дойдет.
Global.mainModule.getSapfor().refreshPid(); //без сапфора сюда это все равно не дойдет.
UI.CreateMenus();
UI.CreateWindows();
}
public static void ServerMode() throws Exception {
CheckServerDirectories();
CreateLogAtComponentsPath();
Utils.createEmptyFile("kek");
componentsServer = new ComponentsServer();
componentsServer.ActivateDB();
componentsServer.Start();

View File

@@ -2,6 +2,7 @@ package _VisualDVM.GlobalData.Compiler;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Global;
import _VisualDVM.Validators.DVMHelpParser;
import _VisualDVM.GlobalData.CompilerEnvironment.CompilerEnvironmentsSet;
import _VisualDVM.GlobalData.CompilerOption.CompilerOptionsSet;
@@ -85,7 +86,7 @@ public class Compiler extends iDBObject {
}
@Override
public boolean isVisible() {
return Current.HasMachine() && Current.getMachine().id == machine_id;
return Global.mainModule.matchCurrentID(Current.Machine, machine_id);
}
//todo понять как извлекать версию чтобы выдавать нормальную инфу.
@Override

View File

@@ -3,6 +3,7 @@ import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.DataSetControlForm;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.Utils;
@@ -101,7 +102,7 @@ public class CompilersDBTable extends iDBTable<Compiler> {
}
@Override
public void ProcessResult() {
Result.machine_id = Current.getMachine().id;
Result.machine_id = Global.mainModule.getMachine().id;
Result.description = fields.tfDescription.getText();
Result.call_command = fields.tfCallCommand.getText();
Result.help_command = fields.tfHelpCommand.getText();

View File

@@ -4,6 +4,7 @@ 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;
@@ -31,13 +32,13 @@ public class CompilerFields implements DialogFields {
CompilerType type = (CompilerType) cbCompilerType.getSelectedItem();
if (type == CompilerType.dvm) {
String dst = null;
if (Current.getMachine().type.equals(MachineType.Local)) {
if (Global.mainModule.getMachine().type.equals(MachineType.Local)) {
File file = directoryChooser.ShowDialog();
if (file != null)
dst = file.getAbsolutePath();
} else {
if (Pass.passes.get(PassCode.SelectRemoteFile).Do(true))
dst = Current.getRemoteFile().full_name;
dst = Global.mainModule.getRemoteFile().full_name;
}
if (dst != null)
tfHome.setText(dst);

View File

@@ -86,8 +86,8 @@ public class DVMParameterDBTable extends iDBTable<DVMParameter> {
}
@Override
public void ProcessResult() {
Result.machine_id = Current.getMachine().id;
Result.run_configuration_id = Current.getRunConfiguration().id;
Result.machine_id = Global.mainModule.getMachine().id;
Result.run_configuration_id = Global.mainModule.getRunConfiguration().id;
Result.name = (String) fields.cbName.getSelectedItem();
Result.value = fields.tfValue.getText();
}

View File

@@ -3,6 +3,7 @@ import Common.CommonConstants;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Global;
public class EnvironmentValue extends iDBObject {
public String name = "";
public String value = "";
@@ -10,7 +11,7 @@ public class EnvironmentValue extends iDBObject {
public int run_configuration_id = CommonConstants.Nan;
@Override
public boolean isVisible() {
return Current.HasRunConfiguration() && (run_configuration_id == Current.getRunConfiguration().id);
return Global.mainModule.matchCurrentID(Current.RunConfiguration, run_configuration_id);
}
@Override
public String toString() {

View File

@@ -53,8 +53,8 @@ public class EnvironmentValuesDBTable extends iDBTable<EnvironmentValue> {
}
@Override
public void ProcessResult() {
Result.machine_id = Current.getMachine().id;
Result.run_configuration_id = Current.getRunConfiguration().id;
Result.machine_id = Global.mainModule.getMachine().id;
Result.run_configuration_id = Global.mainModule.getRunConfiguration().id;
Result.name = (String) fields.cbName.getSelectedItem();
Result.value = fields.tfValue.getText();
}

View File

@@ -84,11 +84,11 @@ public class GlobalDatabase extends VisualiserDatabase {
//---------------------------------------------------------------------------------
@Override
public void Init() throws Exception {
Current_.set(Current.Account,
Global.mainModule.set(Current.Account,
accounts.Data.isEmpty() ? Insert(new Account()) :
accounts.getFirstRecord()
);
Current_.set(Current.Credentials,
Global.mainModule.set(Current.Credentials,
credentials.Data.isEmpty() ? Insert(new Credentials()) :
credentials.getFirstRecord());
//настройки компонент
@@ -101,17 +101,17 @@ public class GlobalDatabase extends VisualiserDatabase {
}
public void SaveCredentials(){
try {
Credentials credentials = (Credentials) Current_.get(Current.Credentials);
if (Current.HasMachine())
credentials.machine_id = Current.getMachine().id;
if (Current.HasUser())
credentials.user_id = Current.getUser().id;
if (Current.HasCompiler())
credentials.compiler_id = Current.getCompiler().id;
if (Current.HasMakefile())
credentials.makefile_id = Current.getMakefile().id;
if (Current.HasRunConfiguration())
credentials.runconfiguration_id = Current.getRunConfiguration().id;
Credentials credentials = Global.mainModule.getCredentials();
if (Global.mainModule.HasMachine())
credentials.machine_id = Global.mainModule.getMachine().id;
if (Global.mainModule.HasUser())
credentials.user_id = Global.mainModule.getUser().id;
if (Global.mainModule.HasCompiler())
credentials.compiler_id = Global.mainModule.getCompiler().id;
if (Global.mainModule.HasMakefile())
credentials.makefile_id = Global.mainModule.getMakefile().id;
if (Global.mainModule.HasRunConfiguration())
credentials.runconfiguration_id = Global.mainModule.getRunConfiguration().id;
Update(credentials);
}
catch (Exception ex){
@@ -120,7 +120,7 @@ public class GlobalDatabase extends VisualiserDatabase {
}
public void UpdateCredentials() {
try {
Update((DBObject) Current_.get(Current.Credentials));
Update(Global.mainModule.getCredentials());
} catch (Exception ex) {
Utils_.MainLog.PrintException(ex);
}

View File

@@ -23,7 +23,7 @@ public class Makefile extends ModuleAnchestor {
}
@Override
public boolean isVisible() {
return Current.HasMachine() && (machine_id == Current.getMachine().id);
return Global.mainModule.matchCurrentID(Current.Machine, machine_id);
}
public LinkedHashMap<LanguageName, Module> getActiveModules() {
return Global.mainModule.getDb().getByFKAndGroupBy(this, Module.class, "language", LanguageName.class).values().stream().filter(Module::isSelected).collect(Collectors.toMap(module -> module.language, module -> module, (a, b) -> b, LinkedHashMap::new));
@@ -177,26 +177,26 @@ public class Makefile extends ModuleAnchestor {
Log.Writeln("Линковщик не выбран");
else {
if (linker.type.equals(CompilerType.dvm)) {
if (!Current.getProject().languageName.getDVMLink().equals(command))
if (!Global.mainModule.getProject().languageName.getDVMLink().equals(command))
Log.Writeln("команда линковки " +
Utils_.Quotes(command) +
" не соответствует языку текущего проекта "
+ Current.getProject().languageName.getDescription() + "\n" +
"Используйте команду " + Current.getProject().languageName.getDVMLink());
+ Global.mainModule.getProject().languageName.getDescription() + "\n" +
"Используйте команду " + Global.mainModule.getProject().languageName.getDVMLink());
}
}
LinkedHashMap<LanguageName, Module> modules = getModules();
for (Module module : modules.values()) {
boolean isMain = module.language.equals(Current.getProject().languageName);
boolean isMain = module.language.equals(Global.mainModule.getProject().languageName);
if (module.isSelected()) {
if (module.getCompiler() == null)
Log.Writeln("Не назначен компилятор для языка " + module.language.getDescription());
if (isMain && Current.getProject().getPrograms().get(module.language).isEmpty())
if (isMain && Global.mainModule.getProject().getPrograms().get(module.language).isEmpty())
Log.Writeln("В текущем проекте не найдено ни одной программы на языке " + module.language.getDescription());
} else {
if (isMain)
Log.Writeln("Языковой модуль, соответствующий языку текущего проекта " +
Current.getProject().languageName.getDescription() + " не помечен как активный.");
Global.mainModule.getProject().languageName.getDescription() + " не помечен как активный.");
}
}
}

View File

@@ -20,7 +20,7 @@ public class Module extends ModuleAnchestor {
}
@Override
public boolean isVisible() {
return Current.HasMakefile() && (makefile_id == Current.getMakefile().id);
return Global.mainModule.matchCurrentID(Current.Makefile, makefile_id);
}
@Override
public boolean isSelected() {

View File

@@ -3,6 +3,7 @@ import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.Controls.StyledTextComboBox;
import Common.Visual.Windows.Dialog.DialogFields;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Compiler.Compiler;
import _VisualDVM.GlobalData.Makefile.Makefile;
import _VisualDVM.GlobalData.Module.Module;
@@ -27,7 +28,7 @@ public class ModuleAnchestorFields implements DialogFields {
//считаем что машина есть.
public ModuleAnchestorFields() {
//-
LinkedHashMap<Integer, Compiler> compilers = Current.getMachine().getCompilers();
LinkedHashMap<Integer, Compiler> compilers = Global.mainModule.getMachine().getCompilers();
compilers.values().forEach(compiler -> cbCompilers.addItem(compiler));
bHelp.addActionListener(e -> {
if (cbCompilers.getSelectedItem() != null) {
@@ -53,7 +54,7 @@ public class ModuleAnchestorFields implements DialogFields {
public void setListeners(ModuleAnchestor target) {
boolean linker = (target instanceof Makefile);
LanguageName languageName = linker ?
(Current.HasProject() ? Current.getProject().languageName : LanguageName.n) :
(Global.mainModule.HasProject() ? Global.mainModule.getProject().languageName : LanguageName.n) :
((Module) target).language;
cbCompilers.addActionListener(e -> {
if (cbCompilers.getSelectedItem() instanceof Compiler) {

View File

@@ -3,6 +3,7 @@ import Common.CommonConstants;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Compiler.Compiler;
import _VisualDVM.GlobalData.Compiler.CompilerType;
import _VisualDVM.GlobalData.Makefile.Makefile;
@@ -101,7 +102,7 @@ public class ModuleAnchestorForm<T extends ModuleAnchestor> extends DBObjectDial
}
@Override
public void ProcessResult() {
Result.machine_id = Current.getMachine().id;
Result.machine_id = Global.mainModule.getMachine().id;
Compiler compiler = (Compiler) fields.cbCompilers.getSelectedItem();
Result.compiler_id = (compiler != null) ? compiler.id : CommonConstants.Nan;
Result.command = command;

View File

@@ -4,6 +4,7 @@ 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 com.jcraft.jsch.ChannelSftp.LsEntry;
@@ -36,11 +37,11 @@ public class RemoteFileChooser extends Dialog<String, RemoteFileChooserFields> {
}
}
public void ShowCurrentRemoteFile() {
fields.lCurrentFile.setText(Current.getRemoteFile().full_name);
fields.lCurrentFile.setText(Global.mainModule.getRemoteFile().full_name);
}
public void Refresh(String path) {
try {
Current_.set(Current.RemoteFile, null);//сброс текущего файла перед любым обновлением.
Global.mainModule.set(Current.RemoteFile, null);//сброс текущего файла перед любым обновлением.
fields.lCurrentFile.setText("?");
//-------------------------------------------------------------------
root_file = new RemoteFile(path, true);
@@ -89,8 +90,8 @@ public class RemoteFileChooser extends Dialog<String, RemoteFileChooserFields> {
@Override
public void validateFields() {
String target_name = target_is_directory ? "папка" : "файл";
if (Current.HasRemoteFile()) {
if (target_is_directory != Current.getRemoteFile().isDirectory)
if (Global.mainModule.HasRemoteFile()) {
if (target_is_directory != Global.mainModule.getRemoteFile().isDirectory)
Log.Writeln("Выбранный объект - не " + target_name);
} else Log.Writeln(target_name + " не выбран(а)");
}

View File

@@ -2,6 +2,7 @@ package _VisualDVM.GlobalData.RemoteFile.UI;
import _VisualDVM.Current;
import Common.Visual.Trees.DataTree;
import Common.Visual.Trees.TreeRenderers;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
public class RemoteFilesTree extends DataTree {
public RemoteFilesTree() {
@@ -21,8 +22,8 @@ public class RemoteFilesTree extends DataTree {
}
@Override
public void LeftMouseAction2() {
if (Current.HasRemoteFile() && Current.getRemoteFile().isDirectory()) {
UI.getRemoteFileChooser().Refresh(Current.getRemoteFile().full_name);
if (Global.mainModule.HasRemoteFile() && Global.mainModule.getRemoteFile().isDirectory()) {
UI.getRemoteFileChooser().Refresh(Global.mainModule.getRemoteFile().full_name);
}
}
}

View File

@@ -183,7 +183,7 @@ public class RunConfiguration extends iDBObject {
}
@Override
public boolean isVisible() {
return Current.HasMachine() && (machine_id == Current.getMachine().id);
return Global.mainModule.matchCurrentID(Current.Machine, machine_id);
}
@Override
public String getFKName() {

View File

@@ -65,11 +65,11 @@ public class RunConfigurationsDBTable extends iDBTable<RunConfiguration> {
fields.maxMatrixPanel.add(fields.maxMatrixBar = new MatrixBar(Result.maxMatrix));
//------------------------------------------->>>
if (!edit)
fields.sMaxDim.setValue(Current.getProject().maxdim);
fields.sMaxDim.setValue(Global.mainModule.getProject().maxdim);
}
@Override
public void ProcessResult() {
Result.machine_id = Current.getMachine().id;
Result.machine_id = Global.mainModule.getMachine().id;
Result.LauncherCall = fields.cbLauncherCall.getSelectedItem().toString();
Result.LauncherOptions = (String) fields.cbLaunchOptions.getSelectedItem();
if (fields.cbLauncherCall.getSelectedItem() instanceof Compiler) {

View File

@@ -2,6 +2,7 @@ package _VisualDVM.GlobalData.SapforProfileSetting;
import Common.CommonConstants;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Settings.SettingName;
import com.sun.org.glassfish.gmbal.Description;
public class SapforProfileSetting extends iDBObject {
@@ -13,6 +14,6 @@ public class SapforProfileSetting extends iDBObject {
public int sapforprofile_id = CommonConstants.Nan;
@Override
public boolean isVisible() {
return Current.HasSapforProfile() && Current.getSapforProfile().id == sapforprofile_id;
return Global.mainModule.matchCurrentID(Current.SapforProfile, sapforprofile_id);
}
}

View File

@@ -74,10 +74,10 @@ public class CompilationTask extends Task {
@Override
public boolean isVisible() {
return
Current_.matchCurrentID(Current.Machine, machine_id) &&
Current_.matchCurrentID(Current.User, user_id) &&
Current.HasProject() &&
belongsToProject(Current.getProject());
Global.mainModule.matchCurrentID(Current.Machine, machine_id) &&
Global.mainModule.matchCurrentID(Current.User, user_id) &&
Global.mainModule.HasProject() &&
belongsToProject(Global.mainModule.getProject());
}
public Makefile getMakefile() {
return Global.mainModule.getDb().getById(Makefile.class, makefile_id);

View File

@@ -1,6 +1,7 @@
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;
public abstract class TaskLocalPass<S extends TaskSupervisor> extends ProcessPass {
@@ -26,6 +27,6 @@ public abstract class TaskLocalPass<S extends TaskSupervisor> extends ProcessPas
}
@Override
public void Interrupt() throws Exception {
Current.getProject().CreateInterruptFile();
Global.mainModule.getProject().CreateInterruptFile();
}
}

View File

@@ -53,13 +53,13 @@ public class RunTask extends Task {
@Override
public boolean isVisible() {
return
Current_.matchCurrentID(Current.Machine, machine_id) &&
Current_.matchCurrentID(Current.User, user_id) &&
Current_.matchCurrentID(Current.RunConfiguration, run_configuration_id) &&
Current.HasProject() &&
belongsToProject(Current.getProject()) &&
Current.HasCompilationTask() &&
compilation_task_id == Current.getCompilationTask().id;
Global.mainModule.matchCurrentID(Current.Machine, machine_id) &&
Global.mainModule.matchCurrentID(Current.User, user_id) &&
Global.mainModule.matchCurrentID(Current.RunConfiguration, run_configuration_id) &&
Global.mainModule.HasProject() &&
belongsToProject(Global.mainModule.getProject()) &&
Global.mainModule.HasCompilationTask() &&
compilation_task_id == Global.mainModule.getCompilationTask().id;
}
public RunConfiguration getRunConfiguration() {
return (Global.mainModule.getDb()).runConfigurations.Data.get(run_configuration_id);

View File

@@ -1,5 +1,6 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Linux;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
import java.util.Map;
@@ -16,7 +17,7 @@ public class LinuxLocalRunSupervisor extends LinuxLocalTaskSupervisor<RunTask> {
}
@Override
protected Map<String, String> getEnvs() {
return Current.getRunConfiguration().getEnvMap();
return Global.mainModule.getRunConfiguration().getEnvMap();
}
@Override
protected String getScriptText() {

View File

@@ -1,5 +1,6 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Windows;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
import java.util.Map;
@@ -25,7 +26,7 @@ public class WindowsLocalRunSupervisor extends WindowsLocalTaskSupervisor<RunTas
}
@Override
protected Map<String, String> getEnvs() {
return Current.getRunConfiguration().getEnvMap();
return Global.mainModule.getRunConfiguration().getEnvMap();
}
void kill_mpi() throws Exception {
}

View File

@@ -1,6 +1,7 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Remote;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
import _VisualDVM.GlobalData.Tasks.QueueSystem.MVS;
import _VisualDVM.GlobalData.Tasks.TaskState;
@@ -29,7 +30,7 @@ public class MVSRunSupervisor extends ServerRunSupervisor {
}
@Override
protected void StartTask() throws Exception {
String env = String.join(" ", Current.getRunConfiguration().getEnvList());
String env = String.join(" ", Global.mainModule.getRunConfiguration().getEnvList());
mvs_time = (task.maxtime / 60); //в минутах
if (task.maxtime % 60 > 0) mvs_time += 1;
String res = "maxtime=" + Utils_.DQuotes(mvs_time) + " ./run";

View File

@@ -1,5 +1,6 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Remote;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
@@ -14,7 +15,7 @@ public class ServerRunSupervisor extends RemoteTaskSupervisor<RunTask> {
@Override
protected void StartTask() throws Exception {
String res = "./run";
String env = String.join(" ", Current.getRunConfiguration().getEnvList());
String env = String.join(" ", Global.mainModule.getRunConfiguration().getEnvList());
if (!env.isEmpty()) res = env + " " + res;
//--
task.PID = pass.user.connection.startShellProcess(getRemoteProject(),"PID",

View File

@@ -2,6 +2,7 @@ package _VisualDVM.GlobalData.User;
import Common.CommonConstants;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Machine.Machine;
import _VisualDVM.TestingSystem.DVM.UserConnection;
import com.sun.org.glassfish.gmbal.Description;
@@ -38,7 +39,7 @@ public class User extends iDBObject {
}
@Override
public boolean isVisible() {
return Current.HasMachine() && Current.getMachine().id == machine_id;
return Global.mainModule.matchCurrentID(Current.Machine, machine_id);
}
@Override
public String getDialogName() {

View File

@@ -2,6 +2,7 @@ package _VisualDVM.GlobalData.User;
import _VisualDVM.Current;
import Common.Visual.DataSetControlForm;
import Common.Visual.Tables.TableRenderers;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import Common.Database.Objects.DBObject;
@@ -43,7 +44,7 @@ public class UsersDBTable extends iDBTable<User> {
}
@Override
public void fillFields() {
if (Current.getMachine().type.equals(MachineType.Local)) {
if (Global.mainModule.getMachine().type.equals(MachineType.Local)) {
Result.login = "этот пользователь";
fields.tfLogin.setEditable(false);
}
@@ -58,7 +59,7 @@ public class UsersDBTable extends iDBTable<User> {
}
@Override
public void ProcessResult() {
Result.machine_id = Current.getMachine().id;
Result.machine_id =Global.mainModule.getMachine().id;
Result.login = fields.tfLogin.getText();
Result.authentication = UserAuthentication.password;
Result.password = new String(fields.tfPassword.getPassword());

View File

@@ -1,8 +1,291 @@
package _VisualDVM;
import Common.Current_;
import MainModule_.MainModule_;
import Visual_DVM_2021.Passes.UI.PassForm;
import _VisualDVM.GlobalData.Account.Account;
import _VisualDVM.GlobalData.Compiler.Compiler;
import _VisualDVM.GlobalData.Credentials.Credentials;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.GlobalData.Machine.Machine;
import _VisualDVM.GlobalData.Makefile.Makefile;
import _VisualDVM.GlobalData.Module.Module;
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
import _VisualDVM.GlobalData.RunConfiguration.RunConfiguration;
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
import _VisualDVM.GlobalData.User.User;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.Project.db_project_info;
import _VisualDVM.ProjectData.ProjectView;
import _VisualDVM.ProjectData.SapforData.Functions.FuncInfo;
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.Component.Component;
import _VisualDVM.Repository.Component.Sapfor.Sapfor;
import _VisualDVM.Repository.SubscriberWorkspace.SubscriberWorkspace;
import _VisualDVM.Repository.Subscribes.Subscriber;
import _VisualDVM.TestingSystem.Common.Group.Group;
import _VisualDVM.TestingSystem.Common.Test.Test;
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage;
import _VisualDVM.TestingSystem.DVM.DVMTasks.DVMRunTask;
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
import _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettings;
import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;
public class MainModule extends MainModule_<GlobalDatabase> {
public MainModule() {
super(GlobalDatabase.class);
}
//--
public boolean HasProject() {return get(Current.Project) != null;}
public db_project_info getProject() {
return (db_project_info) get(Current.Project);
}
//--
public boolean HasFile() {
return get(Current.File) != null;
}
public boolean HasAccount() { return get(Current.Account) != null; }
public boolean HasMachine() {
return get(Current.Machine) != null;
}
public boolean HasUser() {
return get(Current.User) != null;
}
public boolean HasCompiler() {
return get(Current.Compiler) != null;
}
public boolean HasRemoteFile() {
return get(Current.RemoteFile) != null;
}
public boolean HasMakefile() {
return get(Current.Makefile) != null;
}
public boolean HasRunConfiguration() {
return get(Current.RunConfiguration) != null;
}
public boolean HasCompilationTask() {
return get(Current.CompilationTask) != null;
}
public boolean HasRunTask() {
return get(Current.RunTask) != null;
}
public boolean HasPassForm() {
return get(Current.PassForm) != null;
}
public boolean HasProjectView() {
return get(Current.ProjectView) != null;
}
public Credentials getCredentials(){
return (Credentials) get(Current.Credentials);
}
public SapforSettings getSapforSettings() {
return (SapforSettings) get(Current.SapforSettings);
}
public boolean HasSapforSettings() {
return get(Current.SapforSettings) != null;
}
public DBProjectFile getFile() {
return (DBProjectFile) get(Current.File);
}
public Component getComponent() {
return (Component) get(Current.Component);
}
public BugReport getBugReport() {
return (BugReport) get(Current.BugReport);
}
public db_project_info getRoot() {
return (db_project_info) get(Current.Root);
}
public boolean HasRoot() {
return get(Current.Root) != null;
}
public db_project_info getVersion() {
return (db_project_info) get(Current.Version);
}
public Account getAccount() {
return (Account) get(Current.Account);
}
public boolean HasSubscriber() {
return get(Current.Subscriber) != null;
}
public Subscriber getSubscriber() {
return (Subscriber) get(Current.Subscriber);
}
public Machine getMachine() {
return (Machine) get(Current.Machine);
}
public User getUser() {
return (User) get(Current.User);
}
public Compiler getCompiler() {
return (Compiler) get(Current.Compiler);
}
public CompilationTask getCompilationTask() {
return (CompilationTask) get(Current.CompilationTask);
}
public RunTask getRunTask() {
return (RunTask) get(Current.RunTask);
}
public RemoteFile getRemoteFile() {
return (RemoteFile) get(Current.RemoteFile);
}
public Makefile getMakefile() {
return (Makefile) get(Current.Makefile);
}
public Module getModule() {
return (Module) get(Current.Module);
}
public RunConfiguration getRunConfiguration() {
return (RunConfiguration) get(Current.RunConfiguration);
}
public Sapfor getSapfor() {
return (Sapfor) get(Current.Sapfor);
}
public boolean HasGroup() {
return get(Current.Group) != null;
}
public Group getGroup() {
return (Group) get(Current.Group);
}
public boolean HasConfiguration() {
return get(Current.DVMConfiguration) != null;
}
public DVMConfiguration getDVMConfiguration() {
return (DVMConfiguration) get(Current.DVMConfiguration);
}
public SapforConfiguration getSapforConfiguration() {
return (SapforConfiguration) get(Current.SapforConfiguration);
}
public Test getTest() {
return (Test) get(Current.Test);
}
public boolean HasTest() {
return get(Current.Test) != null;
}
public boolean HasVersion() {
return get(Current.Version) != null;
}
public RemoteFile getComponentServerBackup() {
return (RemoteFile) get(Current.ComponentServerBackup);
}
public boolean HasComponentServerBackup() {
return get(Current.ComponentServerBackup) != null;
}
public DefaultMutableTreeNode getProjectNode() {
return (DefaultMutableTreeNode) get(Current.ProjectNode);
}
public DefaultMutableTreeNode getProjectCurrentParentNode() {
DefaultMutableTreeNode node = getProjectNode();
//если в дереве еще никто не выделялся, берем корень.
if (node == null)
return getProject().filesTreeRoot;
return (node.getUserObject() instanceof DBProjectFile) ? (DefaultMutableTreeNode) node.getParent() : node;
}
public File getSelectedDirectory() {
return (File) get(Current.SelectedDirectory);
}
public DBProjectFile getSelectedFile() {
return (DBProjectFile) get(Current.SelectedFile);
}
public boolean HasBugReport() {
return get(Current.BugReport) != null;
}
public PassForm getPassForm() {
return (PassForm) get(Current.PassForm);
}
public ParallelRegion getParallelRegion() {
return (ParallelRegion) get(Current.ParallelRegion);
}
public boolean HasParallelRegion() {
return get(Current.ParallelRegion) != null;
}
public boolean HasFunction() {
return get(Current.Function) != null;
}
public boolean HasSelectedFunction() {
return get(Current.SelectedFunction) != null;
}
public FuncInfo getFunction() {
return (FuncInfo) get(Current.Function);
}
public FuncInfo getSelectionFunction() {
return (FuncInfo) get(Current.SelectedFunction);
}
public boolean HasScenario() {
return get(Current.Scenario) != null;
}
public db_project_info getPackageVersion() {
return (db_project_info) get(Current.PackageVersion);
}
public boolean HasPackageVersion() {
return get(Current.PackageVersion) != null;
}
public boolean HasSapforConfiguration() {
return get(Current.SapforConfiguration) != null;
}
public ProjectView getProjectView() {
return (ProjectView) get(Current.ProjectView);
}
public boolean HasSapforProfile() {
return get(Current.SapforProfile) != null;
}
public SapforProfile getSapforProfile() {
return (SapforProfile) get(Current.SapforProfile);
}
public boolean HasServerSapfor() {
return get(Current.ServerSapfor) != null;
}
public ServerSapfor getServerSapfor() {
return (ServerSapfor) get(Current.ServerSapfor);
}
public boolean HasSubscriberWorkspace() {
return get(Current.SubscriberWorkspace) != null;
}
public SubscriberWorkspace getSubscriberWorkspace() {
return (SubscriberWorkspace) get(Current.SubscriberWorkspace);
}
public boolean HasDVMPackage() {
return get(Current.DVMPackage) != null;
}
public DVMPackage getDVMPackage() {
return (DVMPackage) get(Current.DVMPackage);
}
public boolean HasSapforPackage() {
return get(Current.SapforPackage) != null;
}
public SapforPackage getSapforPackage() {
return (SapforPackage) get(Current.SapforPackage);
}
public boolean HasDVMRunTask() {
return get(Current.DVMRunTask) != null;
}
public DVMRunTask getDVMRunTask() {
return (DVMRunTask) get(Current.DVMRunTask);
}
public void DropCurrentFile(){
set(Current.File, null);
set(Current.FileGraphElement, null);
set(Current.Notes, null);
set(Current.Warnings, null);
set(Current.Errors, null);
}
public void DropCurrentProject(){
set(Current.Project, null);
set(Current.File, null);
set(Current.Function, null);
set(Current.SelectedFunction,null);
set(Current.ProjectNode, null);
set(Current.SelectedFile, null);
set(Current.SelectedDirectory, null);
set(Current.ParallelVariant, null);
set(Current.Dimensions, null);
set(Current.Array, null);
set(Current.DBArray, null);
}
}

View File

@@ -2,6 +2,7 @@ package _VisualDVM.ProjectData.Files;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.ProjectData.GCOV.GCOV_info;
import _VisualDVM.ProjectData.LanguageName;
@@ -356,7 +357,7 @@ public class DBProjectFile extends ProjectFile {
for (FuncInfo fi : function_decls.values()) {
for (FuncCall fc : fi.calls) {
if ((fc.line == form.getEditor().getCurrentLine()) &&
!Current.getSapfor().isIntrinsic(fc.funcName)
!Global.mainModule.getSapfor().isIntrinsic(fc.funcName)
) {
return fc;
}
@@ -416,7 +417,7 @@ public class DBProjectFile extends ProjectFile {
break;
}
languageName = parent.languageName;
if (sapforStyle) style = Current.getSapfor().getStyle();
if (sapforStyle) style = Global.mainModule.getSapfor().getStyle();
else style = parent.style;
}
public void importSourceCodeSettings(DBProjectFile parent, boolean sapforStyle) throws Exception {
@@ -430,7 +431,7 @@ public class DBProjectFile extends ProjectFile {
break;
}
languageName = parent.languageName;
if (sapforStyle) style = Current.getSapfor().getStyle();
if (sapforStyle) style =Global.mainModule.getSapfor().getStyle();
else style = parent.style;
}
//------------------

View File

@@ -65,7 +65,7 @@ public class SPFEditor extends BaseEditor implements SPFEditorInterface {
if (!switching_language) {
file.NeedsSave = true;
if (Global.enable_text_changed && file.state != FileState.Excluded) {
Current.getSapfor().ResetAllAnalyses();
Global.mainModule.getSapfor().ResetAllAnalyses();
//текст изменился, значит M ка более не актуальна.
file.father.dropLastModification();
}

View File

@@ -3,6 +3,7 @@ import Common.Current_;
import _VisualDVM.Current;
import Common.Visual.Trees.DataTree;
import Common.Visual.Trees.TreeRenderers;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.SapforData.FileObject;
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
@@ -22,11 +23,11 @@ public class FileGraphTree extends DataTree {
}
@Override
public void ShowCurrentObject() throws Exception {
Current.getFile().form.EventsOff();
Object o = Current_.get(getCurrent());
Current.getFile().form.getEditor().gotoLine((o instanceof FileObjectWithMessages) ? (((FileObjectWithMessages) o).line) : 1);
Current.getFile().form.ShowMessages();
Current.getFile().form.EventsOn();
Global.mainModule.getFile().form.EventsOff();
Object o = Global.mainModule.get(getCurrent());
Global.mainModule.getFile().form.getEditor().gotoLine((o instanceof FileObjectWithMessages) ? (((FileObjectWithMessages) o).line) : 1);
Global.mainModule.getFile().form.ShowMessages();
Global.mainModule.getFile().form.EventsOn();
}
@Override
protected boolean findNode(Object userObject, Object criteria) {

View File

@@ -19,7 +19,7 @@ import java.awt.event.KeyEvent;
import java.io.File;
public class FilesTree extends StyledTree {
public FilesTree() {
super(Current.getProject().filesTreeRoot);
super(Global.mainModule.getProject().filesTreeRoot);
this.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
@@ -48,10 +48,10 @@ public class FilesTree extends StyledTree {
new FileDrop(System.out, this, files -> {
Pass.passes.get(PassCode.ImportFiles).Do(files);
});
Current_.set(Current.File, null);
Global.mainModule.set(Current.File, null);
}
private static void forkFD(PassCode file_pass, PassCode folder_pass) {
DefaultMutableTreeNode node = Current.getProjectNode();
DefaultMutableTreeNode node = Global.mainModule.getProjectNode();
if (node != null)
Pass.passes.get((node.getUserObject() instanceof DBProjectFile) ?
file_pass : folder_pass).Do();
@@ -67,24 +67,24 @@ public class FilesTree extends StyledTree {
@Override
public void SelectionAction(TreePath e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getLastPathComponent();
Current_.set(Current.ProjectNode, node);
Global.mainModule.set(Current.ProjectNode, node);
Object o = node.getUserObject();
if (o instanceof File) {
Current_.set(Current.SelectedDirectory, o);
Current_.set(Current.SelectedFile, null);
Global.mainModule.set(Current.SelectedDirectory, o);
Global.mainModule.set(Current.SelectedFile, null);
UI.getMainWindow().getProjectWindow().ShowNoSelectedFile();
} else if (o instanceof DBProjectFile) {
Current_.set(Current.SelectedFile, o);
Global.mainModule.set(Current.SelectedFile, o);
File file = ((DBProjectFile) o).file;
Current_.set(Current.SelectedDirectory, file.getParentFile());
Global.mainModule.set(Current.SelectedDirectory, file.getParentFile());
UI.getMainWindow().getProjectWindow().ShowSelectedFile();
}
UI.getMainWindow().getProjectWindow().ShowSelectedDirectory();
}
@Override
public void LeftMouseAction2() {
if (Current.getProjectNode() != null) {
Object o = Current.getProjectNode().getUserObject();
if (Global.mainModule.getProjectNode() != null) {
Object o = Global.mainModule.getProjectNode().getUserObject();
if (o instanceof DBProjectFile) {
//очень важно. иначе по открытии файла дерево остается в фокусе.
//и не происходит прокрутки скролла к строке!!
@@ -95,8 +95,8 @@ public class FilesTree extends StyledTree {
}
@Override
public void LeftMouseAction1() {
if (Global.files_multiselection && Current.getSelectedFile() != null) {
Current.getSelectedFile().SwitchSelection();
if (Global.files_multiselection && Global.mainModule.getSelectedFile() != null) {
Global.mainModule.getSelectedFile().SwitchSelection();
updateUI();
}
}

View File

@@ -449,8 +449,8 @@ public class Message extends FileObject {
}
@Override
public boolean isVisible() {
if (Current.HasFile() && Current.getFile().name.equals(file)) {
Object o = Current_.get(Current.FileGraphElement);
if (Global.mainModule.HasFile() && Global.mainModule.getFile().name.equals(file)) {
Object o =Global.mainModule.get(Current.FileGraphElement);
return !(o instanceof FileObjectWithMessages) || ((FileObjectWithMessages) o).HasMessage(this);
} else return false;
}

View File

@@ -5,6 +5,7 @@ import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import Common.Visual.Tables.ColumnFilter;
import Common.Visual.Tables.TableRenderers;
import _VisualDVM.Global;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
@@ -23,7 +24,7 @@ public class MessagesDBTable<M extends Message> extends iDBTable<M> {
@Override
public void ShowCurrentObject() throws Exception {
super.ShowCurrentObject();
Current.getFile().form.getEditor().gotoLine(getCurrent().line);
Global.mainModule.getFile().form.getEditor().gotoLine(getCurrent().line);
}
@Override
protected void AdditionalInitColumns() {

View File

@@ -15,7 +15,7 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class VersionsTree extends DataTree {
public VersionsTree() {
super(Current.getRoot().node);
super(Global.mainModule.getRoot().node);
SelectCurrentProject();
this.addKeyListener(new KeyAdapter() {
@Override
@@ -25,8 +25,8 @@ public class VersionsTree extends DataTree {
Pass.passes.get(PassCode.DeleteVersion).Do();
break;
case KeyEvent.VK_ENTER:
if (Current.HasVersion())
Pass.passes.get(PassCode.OpenCurrentProject).Do(Current.getVersion());
if (Global.mainModule.HasVersion())
Pass.passes.get(PassCode.OpenCurrentProject).Do(Global.mainModule.getVersion());
break;
}
}
@@ -41,7 +41,7 @@ public class VersionsTree extends DataTree {
return Current.Version;
}
public void SelectCurrentProject() {
setSelectionPath(new TreePath(Current.getProject().node.getPath()));
setSelectionPath(new TreePath(Global.mainModule.getProject().node.getPath()));
}
@Override
protected GraphMenu createMenu() {
@@ -51,7 +51,7 @@ public class VersionsTree extends DataTree {
public void LeftMouseAction1() {
if (Global.versions_multiselection) {
// только если есть режим выбора версий.
Object element = Current_.get(getCurrent());
Object element = Global.mainModule.get(getCurrent());
if ((element instanceof Selectable)) {
((Selectable) element).SwitchSelection();
updateUI();
@@ -60,7 +60,7 @@ public class VersionsTree extends DataTree {
}
@Override
public void LeftMouseAction2() {
Pass.passes.get(PassCode.OpenCurrentProject).Do(Current.getVersion());
Pass.passes.get(PassCode.OpenCurrentProject).Do(Global.mainModule.getVersion());
}
@Override
protected int getStartLine() {

View File

@@ -24,9 +24,9 @@ public class VersionsTreeCellRenderer extends StyledTreeCellRenderer {
setIcon(((Selectable) o).GetSelectionIcon());
} else {
URL imageUrl = null;
boolean current = Current.HasProject() && version.Home.equals(Current.getProject().Home);
boolean current = Global.mainModule.HasProject() && version.Home.equals(Global.mainModule.getProject().Home);
String type_image_key = "";
if (version.Home.equals(Current.getRoot().Home))
if (version.Home.equals(Global.mainModule.getRoot().Home))
type_image_key = "Root";
else if (version.IsMCopy())
type_image_key = "M";

View File

@@ -435,8 +435,8 @@ public class db_project_info extends DBObject {
db.ResetAI(MessageWarning.class);
db.ResetAI(MessageRecommendation.class);
//-
Current_.set(Current.Function, null);
Current_.set(Current.SelectedFunction, null);
Global.mainModule.set(Current.Function, null);
Global.mainModule.set(Current.SelectedFunction, null);
}
public void CleanVersions() throws Exception {
node.removeAllChildren();
@@ -660,7 +660,7 @@ public class db_project_info extends DBObject {
}
public Vector<DBProjectFile> getFilesForComparsion() {
Vector<DBProjectFile> res = new Vector<>();
if (Current.HasProject() && this.Home.equals(Current.getProject().Home)) {
if (Global.mainModule.HasProject() && this.Home.equals(Global.mainModule.getProject().Home)) {
//
res = db.files.Data.values().stream().filter(file -> !file.state.equals(FileState.Excluded)).collect(Collectors.toCollection(Vector::new));
} else {
@@ -1069,7 +1069,7 @@ public class db_project_info extends DBObject {
target.Close();
}
public void undoLastTransformation() throws Exception {
Current_.set(Current.Version, null);
Global.mainModule.set(Current.Version, null);
//---
UI.getVersionsWindow().getVersionsForm().getTree().RemoveNode(last_version.node);
Utils.forceDeleteWithCheck(last_version.Home);
@@ -1498,8 +1498,8 @@ public class db_project_info extends DBObject {
}
public String getLocalName() {
//требует отображения рута. без него работать не будет.
if (Current.HasRoot())
return Home.getAbsolutePath().substring(Current.getRoot().Home.getParentFile().getAbsolutePath().length() + 1);
if (Global.mainModule.HasRoot())
return Home.getAbsolutePath().substring(Global.mainModule.getRoot().Home.getParentFile().getAbsolutePath().length() + 1);
else return Home.getName();
}
public void SelectAllFiles(boolean b) {

View File

@@ -79,6 +79,6 @@ public class ArraysSet extends DataSet<Long, ProjectArray> {
}
@Override
public void CheckAll(boolean flag) {
Pass.passes.get(PassCode.MassSelectArrays).Do(flag,new Vector(Current.getProject().declaratedArrays.Data.values()));
Pass.passes.get(PassCode.MassSelectArrays).Do(flag,new Vector(Global.mainModule.getProject().declaratedArrays.Data.values()));
}
}

View File

@@ -3,6 +3,7 @@ import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import Common.Utils.Index;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.DBArray.DBArray;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.Dimension;
@@ -104,7 +105,7 @@ public class ProjectArray extends DBObject {
int idxPl = 3;
for (int i = 0; i < numDeclPlaces; ++i, idxPl += 2) {
String declFile = Utils_.toW(localSplited[idxPl]);
DBProjectFile file = Current.getProject().db.files.Data.get(declFile);
DBProjectFile file = Global.mainModule.getProject().db.files.Data.get(declFile);
int declLine = Integer.parseInt(localSplited[idxPl + 1]);
//declPlaces.add(new Pair<>(declFile, declLine));
ArrayDecl decl = new ArrayDecl(shortName, location, file, declLine);
@@ -219,8 +220,8 @@ public class ProjectArray extends DBObject {
}
public void CreateDimensions() {
for (BigInteger regID : regIDs) {
ParallelRegion region = Current.getProject().parallelRegions.get(regID);
for (int i = 0; i < Current.getProject().maxdim; ++i) {
ParallelRegion region = Global.mainModule.getProject().parallelRegions.get(regID);
for (int i = 0; i < Global.mainModule.getProject().maxdim; ++i) {
dimensions.add(new TemplateDimension(
i, this, region
));
@@ -254,9 +255,9 @@ public class ProjectArray extends DBObject {
if (!mask(banned_dimensions, binary)) {
if (filter) {
boolean valid = true;
if (Current.getProject().f_distributed())
if (Global.mainModule.getProject().f_distributed())
valid = CheckFilterMask(i, true, binary);
if (valid && Current.getProject().f_multiplied())
if (valid && Global.mainModule.getProject().f_multiplied())
valid = CheckFilterMask(i, false, binary);
if (valid)
varIDs.add(i);
@@ -275,9 +276,9 @@ public class ProjectArray extends DBObject {
if (!mask(banned_dimensions, binary)) {
if (filter) {
boolean valid = true;
if (Current.getProject().f_distributed())
if (Global.mainModule.getProject().f_distributed())
valid = CheckFilterMask(i, true, binary);
if (valid && Current.getProject().f_multiplied())
if (valid && Global.mainModule.getProject().f_multiplied())
valid = CheckFilterMask(i, false, binary);
return valid;
} else return true;
@@ -344,12 +345,12 @@ public class ProjectArray extends DBObject {
return CheckFilterMask(varID, distributed, "");
}
public void SaveUserState() throws Exception {
if (Current.getProject().db.savedArrays.Data.containsKey(UniqKey)) {
DBArray sa = Current.getProject().db.savedArrays.Data.get(UniqKey);
if (Global.mainModule.getProject().db.savedArrays.Data.containsKey(UniqKey)) {
DBArray sa = Global.mainModule.getProject().db.savedArrays.Data.get(UniqKey);
sa.State = State;
Current.getProject().db.Update(sa);
Global.mainModule.getProject().db.Update(sa);
} else
Current.getProject().db.Insert(new DBArray(this));
Global.mainModule.getProject().db.Insert(new DBArray(this));
}
//-----------------------------------------------------------------------
@Override

View File

@@ -1,23 +1,24 @@
package _VisualDVM.ProjectData.SapforData.Arrays.Templates;
import _VisualDVM.Current;
import _VisualDVM.Global;
public enum TemplateDimensionState {
multiplied, //0
distributed; //1
public String getMaskDescription() {
switch (this) {
case distributed:
if (Current.getProject().f_distributed()) {
if (Global.mainModule.getProject().f_distributed()) {
return "BLOCK";
} else {
if (Current.getProject().f_multiplied())
if (Global.mainModule.getProject().f_multiplied())
return " X ";
else return "BLOCK";
}
case multiplied:
if (Current.getProject().f_multiplied()) {
if (Global.mainModule.getProject().f_multiplied()) {
return " * ";
} else {
if (Current.getProject().f_distributed())
if (Global.mainModule.getProject().f_distributed())
return " X ";
else return " * ";
}

View File

@@ -4,6 +4,7 @@ import _VisualDVM.Current;
import Common.Visual.ControlForm;
import Common.Visual.Tables.Grid.GridAnchestor;
import Common.Visual.Tables.StyledTable;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateDimension;
@@ -32,10 +33,10 @@ public class DimensionsTableForm extends ControlForm<StyledTable> {
public void CreateControl() {
Vector<String> columns = new Vector<>();
columns.add("шаблон");
for (int i = 0; i < Current.getProject().maxdim; ++i)
for (int i = 0; i < Global.mainModule.getProject().maxdim; ++i)
columns.add(ProjectArray.alignNames[i]);
Vector<Object> dimensions = new Vector<>();
Current.getProject().templates.forEach(t -> dimensions.add(t.CreateTemplateCells()));
Global.mainModule.getProject().templates.forEach(t -> dimensions.add(t.CreateTemplateCells()));
control = new StyledTable(new GridAnchestor(columns, dimensions) {
@Override
public Object getValueAt(int rowIndex, int columnIndex) {

View File

@@ -1,9 +1,10 @@
package _VisualDVM.ProjectData.SapforData.Arrays.UI;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.Files.UI.FileGraphTree;
public class FileArraysTree extends FileGraphTree {
public FileArraysTree() {
super(Current.getFile().getArraysTree());
super(Global.mainModule.getFile().getArraysTree());
}
@Override
public String getBranchesName() {

View File

@@ -1,6 +1,7 @@
package _VisualDVM.ProjectData.SapforData.Arrays.UI;
import Common.Current_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Menus.GraphMenu;
import Common.Visual.Trees.StyledTree;
import Common.Visual.Trees.TreeRenderers;
@@ -12,11 +13,11 @@ import javax.swing.tree.TreePath;
import static Common.Visual.Trees.TreeRenderers.RendererRule;
public class RulesTree extends StyledTree {
public RulesTree() {
super(Current.getProject().align_rules_root);
super(Global.mainModule.getProject().align_rules_root);
setRootVisible(false);
expandRow(0);
ExpandAll();
Current_.set(Current.ParallelRegion, null);
Global.mainModule.set(Current.ParallelRegion, null);
}
@Override
protected GraphMenu createMenu() {
@@ -39,6 +40,6 @@ public class RulesTree extends StyledTree {
region = (ParallelRegion) o;
}
}
Current_.set(Current.ParallelRegion, region);
Global.mainModule.set(Current.ParallelRegion, region);
}
}

View File

@@ -2,6 +2,7 @@ package _VisualDVM.ProjectData.SapforData;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import com.sun.org.glassfish.gmbal.Description;
@@ -21,7 +22,7 @@ public abstract class FileObject extends iDBObject {
return "файл " + Utils_.Brackets(file) + " строка: " + line;
}
public DBProjectFile getFather() {
return Current.getProject().db.files.Data.get(file);
return Global.mainModule.getProject().db.files.Data.get(file);
}
public void Show(boolean focus) {
UI.getMainWindow().getProjectWindow().GotoFile(file, line, focus);

View File

@@ -1,9 +1,10 @@
package _VisualDVM.ProjectData.SapforData.Functions.UI;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.Files.UI.FileGraphTree;
public class FileFunctionsTree extends FileGraphTree {
public FileFunctionsTree() {
super(Current.getFile().getFunctionsTree());
super(Global.mainModule.getFile().getFunctionsTree());
}
@Override
public String getBranchesName() {

View File

@@ -2,6 +2,7 @@ package _VisualDVM.ProjectData.SapforData.Functions.UI.Graph;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.ControlForm;
import _VisualDVM.Global;
import com.mxgraph.swing.mxGraphComponent;
import java.awt.*;
@@ -11,7 +12,7 @@ public class FunctionsGraphForm extends ControlForm<mxGraphComponent> {
}
@Override
public void CreateControl() {
control = Current.getProject().DrawFunctionsGraph();
control = Global.mainModule.getProject().DrawFunctionsGraph();
}
@Override
public void Show() {

View File

@@ -4,6 +4,7 @@ import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Visual.Menus.VisualiserMenuItem;
import Common.Visual.Menus.StyledPopupMenu;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import Visual_DVM_2021.Passes.All.SPF_GetGraphFunctionPositions;
import Visual_DVM_2021.Passes.PassCode;
@@ -19,8 +20,8 @@ public class FunctionsGraphMenu extends StyledPopupMenu {
changeCurrent.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (Current.HasSelectedFunction()) {
Current_.set(Current.Function, Current.getSelectionFunction());
if (Global.mainModule.HasSelectedFunction()) {
Global.mainModule.set(Current.Function, Global.mainModule.getSelectionFunction());
UI.getMainWindow().getProjectWindow().getFunctionsWindow().ShowCurrentFunction();
if (SPF_GetGraphFunctionPositions.showByCurrentFunction) {
Pass.passes.get(PassCode.SPF_GetGraphFunctionPositions).Do();
@@ -32,8 +33,8 @@ public class FunctionsGraphMenu extends StyledPopupMenu {
}
@Override
public void CheckElementsVisibility() {
if (Current.HasSelectedFunction()) {
changeCurrent.setText("Назначить процедуру " + Utils_.DQuotes(Current.getSelectionFunction().funcName) + " текущей.");
if (Global.mainModule.HasSelectedFunction()) {
changeCurrent.setText("Назначить процедуру " + Utils_.DQuotes(Global.mainModule.getSelectionFunction().funcName) + " текущей.");
changeCurrent.setEnabled(true);
} else {
changeCurrent.setText("Невозможно назначить текущую процедуру: узел графа не выбран");

View File

@@ -3,6 +3,7 @@ import Common.Current_;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.SapforData.Functions.FuncCoordinates;
import _VisualDVM.ProjectData.SapforData.Functions.FuncInfo;
import _VisualDVM.ProjectData.SapforData.Functions.FunctionType;
@@ -138,10 +139,10 @@ public class FunctionsGraphUI extends mxGraph {
// UI.Info("++");
LinkedHashMap<String, Object> mxVertexes = new LinkedHashMap<>();
for (String name : graph.vertexCoordinates.keySet()) {
funcInfo = Current.getProject().allFunctions.get(name);
funcInfo = Global.mainModule.getProject().allFunctions.get(name);
String vertexType = funcInfo.type.toString();
if (SPF_GetGraphFunctionPositions.showByCurrentFunction) {
FuncInfo current_fi = (FuncInfo) Current_.get(Current.Function);
FuncInfo current_fi = (FuncInfo) Global.mainModule.get(Current.Function);
if ((current_fi != null) && (funcInfo.funcName.equals(current_fi.funcName))) {
vertexType = "current";
}
@@ -200,18 +201,18 @@ public class FunctionsGraphUI extends mxGraph {
// UI.Info(cell.getGeometry().getPoint().toString());
Point point = cell.getGeometry().getPoint();
try {
if (Current.getProject().db.funcCoordinates.containsKey(funcName)) {
coords = Current.getProject().db.funcCoordinates.get(funcName);
if (Global.mainModule.getProject().db.funcCoordinates.containsKey(funcName)) {
coords = Global.mainModule.getProject().db.funcCoordinates.get(funcName);
coords.name = funcName;
coords.X = point.getX();
coords.Y = point.getY();
Current.getProject().db.Update(coords);
Global.mainModule.getProject().db.Update(coords);
} else {
coords = new FuncCoordinates();
coords.name = funcName;
coords.X = point.getX();
coords.Y = point.getY();
Current.getProject().db.Insert(coords);
Global.mainModule.getProject().db.Insert(coords);
}
} catch (Exception ignored) {
}
@@ -231,10 +232,10 @@ public class FunctionsGraphUI extends mxGraph {
mxCell mx_cell = (mxCell) cell;
if (mx_cell.isVertex()) {
String func_name = (String) mx_cell.getValue();
FuncInfo fi = Current.getProject().allFunctions.get(func_name);
FuncInfo fi = Global.mainModule.getProject().allFunctions.get(func_name);
switch (e.getClickCount()) {
case 1:
Current_.set(Current.SelectedFunction, fi);
Global.mainModule.set(Current.SelectedFunction, fi);
break;
case 2:
switch (fi.type) {

View File

@@ -1,5 +1,6 @@
package _VisualDVM.ProjectData.SapforData.Functions.UI;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Menus.SelectionTreeMenu;
import Common.Visual.Trees.SelectableTree;
import _VisualDVM.ProjectData.SapforData.Functions.FuncInfo;
@@ -13,7 +14,7 @@ public class InlineMenu extends SelectionTreeMenu {
}
@Override
public void SelectAll(boolean select) {
for (FuncInfo fi : Current.getProject().allFunctions.values())
for (FuncInfo fi : Global.mainModule.getProject().allFunctions.values())
fi.SelectAllChildren(select);
}
}

View File

@@ -1,13 +1,14 @@
package _VisualDVM.ProjectData.SapforData.Functions.UI;
import Common.Current_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Menus.GraphMenu;
import Common.Visual.Trees.SelectableTree;
import Common.Visual.Trees.TreeRenderers;
import _VisualDVM.ProjectData.SapforData.FileObject;
public class InlineTree extends SelectableTree {
public InlineTree() {
super(Current.getProject().inline_root);
super(Global.mainModule.getProject().inline_root);
}
@Override
public TreeRenderers getRenderer() {
@@ -19,7 +20,7 @@ public class InlineTree extends SelectableTree {
}
@Override
public void ShowCurrentObject() {
Object o = Current_.get(getCurrent());
Object o = Global.mainModule.get(getCurrent());
if (o instanceof FileObject) {
((FileObject) o).Show(false);
}

View File

@@ -1,13 +1,14 @@
package _VisualDVM.ProjectData.SapforData.Functions.UI;
import Common.Current_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Menus.GraphMenu;
import Common.Visual.Trees.SelectableTree;
import Common.Visual.Trees.TreeRenderers;
import _VisualDVM.ProjectData.SapforData.FileObject;
public class InlineTree2 extends SelectableTree {
public InlineTree2() {
super(Current.getProject().inline_root2);
super(Global.mainModule.getProject().inline_root2);
}
@Override
public TreeRenderers getRenderer() {
@@ -23,7 +24,7 @@ public class InlineTree2 extends SelectableTree {
}
@Override
public void ShowCurrentObject() {
Object o = Current_.get(getCurrent());
Object o = Global.mainModule.get(getCurrent());
if (o instanceof FileObject) {
((FileObject) o).Show(false);
}

View File

@@ -1,5 +1,6 @@
package _VisualDVM.ProjectData.SapforData.Includes.UI;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Menus.SelectionTreeMenu;
import Common.Visual.Trees.SelectableTree;
import _VisualDVM.ProjectData.SapforData.Includes.FileInfo;
@@ -13,7 +14,7 @@ public class IncludesMenu extends SelectionTreeMenu {
}
@Override
public void SelectAll(boolean select) {
for (FileInfo fi : Current.getProject().addictedFiles.values())
for (FileInfo fi : Global.mainModule.getProject().addictedFiles.values())
fi.SelectAllChildren(select);
}
}

View File

@@ -1,11 +1,12 @@
package _VisualDVM.ProjectData.SapforData.Includes.UI;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Menus.GraphMenu;
import Common.Visual.Trees.SelectableTree;
import Common.Visual.Trees.TreeRenderers;
public class IncludesTree extends SelectableTree {
public IncludesTree() {
super(Current.getProject().includes_root);
super(Global.mainModule.getProject().includes_root);
}
@Override
public Current getCurrent() {

View File

@@ -1,9 +1,10 @@
package _VisualDVM.ProjectData.SapforData.Loops.UI;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.Files.UI.FileGraphTree;
public class FileLoopsTree extends FileGraphTree {
public FileLoopsTree() {
super(Current.getFile().getLoopsTree());
super(Global.mainModule.getFile().getLoopsTree());
}
@Override
public String getBranchesName() {

View File

@@ -3,6 +3,7 @@ import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import Common.Utils.Index;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.AlignRule;
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.DataDirective;
@@ -63,7 +64,7 @@ public class ParallelRegion extends DBObject {
//-------------------------------------------------------
if (new_array.isTemplFlag == 1) {
maxdim = Math.max(maxdim, new_array.dimSize);
Current.getProject().templates.add(new_array);
Global.mainModule.getProject().templates.add(new_array);
new_array.regIDs.add(regionId);
} else if (new_array.isLoopArrayFlag != 1) arrays_count++;
}
@@ -82,7 +83,7 @@ public class ParallelRegion extends DBObject {
for (String FKey : lines.keySet()) {
for (Pair<Integer, Integer> L : lines.get(FKey)) {
lines_count += (L.getValue() - L.getKey());
DBProjectFile f = Current.getProject().db.files.Data.get(FKey);
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
loops_count += f.FragmentLoopCount(L.getKey(), L.getValue());
fc_count += f.FragmentFunctionCallsCount(L.getKey(), L.getValue());
fd_count += f.FragmentFunctionDeclsCount(L.getKey(), L.getValue());
@@ -111,7 +112,7 @@ public class ParallelRegion extends DBObject {
loops_count = 0;
for (String FKey : lines.keySet()) {
for (Pair<Integer, Integer> L : lines.get(FKey)) {
DBProjectFile f = Current.getProject().db.files.Data.get(FKey);
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
loops_count += f.FragmentLoopCount(L.getKey(), L.getValue());
}
}
@@ -121,7 +122,7 @@ public class ParallelRegion extends DBObject {
fc_count = 0;
for (String FKey : lines.keySet()) {
for (Pair<Integer, Integer> L : lines.get(FKey)) {
DBProjectFile f = Current.getProject().db.files.Data.get(FKey);
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
fc_count += f.FragmentFunctionCallsCount(L.getKey(), L.getValue());
fd_count += f.FragmentFunctionDeclsCount(L.getKey(), L.getValue());
}
@@ -131,7 +132,7 @@ public class ParallelRegion extends DBObject {
arrays_count=0;
for (String FKey : lines.keySet()) {
for (Pair<Integer, Integer> L : lines.get(FKey)) {
DBProjectFile f = Current.getProject().db.files.Data.get(FKey);
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
arrays_count += f.FragmentArraysCount(L.getKey(), L.getValue());
}
}

View File

@@ -1,6 +1,7 @@
package _VisualDVM.ProjectData.SapforData.Regions.UI;
import _VisualDVM.Current;
import Common.Visual.Tables.StyledCellLabel;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
import javafx.util.Pair;
@@ -40,15 +41,15 @@ public class ArrayAlignmentBar extends JToolBar {
add(label);
ChangeListener changeListener = e -> {
//инфа о связях. из списка всех объявленных массивов.
ProjectArray d_array = Current.getProject().declaratedArrays.get(array.id);
ProjectArray d_array = Global.mainModule.getProject().declaratedArrays.get(array.id);
//опять же, берем инфу из объявлений!
for (ProjectArray d_link : d_array.links.values()) {
//это массивы из объявлений. прежде чем их трогать проверим а есть ли они в текущей области.
// по адресам принадлежность смотреть нельзя.
// на момент поиска массивов у них их еще нет. а вот ид совпадают.
if (Current.getParallelRegion().ArrayBelongsToRegion(d_link.id)) {
if (Global.mainModule.getParallelRegion().ArrayBelongsToRegion(d_link.id)) {
//инфа о массиве уже из области. имеющая адрес и бар.
ProjectArray r_link = Current.getParallelRegion().getArrayById(d_link.id);
ProjectArray r_link = Global.mainModule.getParallelRegion().getArrayById(d_link.id);
Pair<JSpinner, JSpinner> pair = r_link.bar.dimensions.get(dim);
pair.getKey().setValue(K.getValue());
pair.getValue().setValue(B.getValue());

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);
}

View File

@@ -23,7 +23,7 @@ public class Group extends riDBObject {
//--
@Override
public boolean isVisible() {
return (!GroupsDBTable.filterMyOnly || Current.getAccount().email.equals(sender_address)) &&
return (!GroupsDBTable.filterMyOnly || Global.mainModule.getAccount().email.equals(sender_address)) &&
Global.testingServer.db.groups.applyFilters(this);
}
public String getSummary() {

View File

@@ -60,7 +60,7 @@ public class Test extends riDBObject {
//---
@Override
public boolean isVisible() {
return Current.HasGroup() && (Current.getGroup().id == group_id);
return Global.mainModule.matchCurrentID(Current.Group,group_id);
}
//-
public File getArchive() {

View File

@@ -3,6 +3,7 @@ import _VisualDVM.Current;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.Global;
import _VisualDVM.TestingSystem.Common.Group.Group;
import _VisualDVM.TestingSystem.Common.Test.UI.TestFields;
@@ -74,8 +75,8 @@ public class TestDBTable extends iDBTable<Test> {
@Override
public void validateFields() {
if (!edit) {
if (!Current.getGroup().language.equals(Current.getProject().languageName))
Log.Writeln_("В текущую группу могут войти только тесты на языке " + Current.getGroup().language);
if (!Global.mainModule.getGroup().language.equals(Global.mainModule.getProject().languageName))
Log.Writeln_("В текущую группу могут войти только тесты на языке " + Global.mainModule.getGroup().language);
}
}
@Override
@@ -90,8 +91,8 @@ public class TestDBTable extends iDBTable<Test> {
Result.min_dim = (int) fields.sMinDim.getValue();
Result.max_dim = (int) fields.sMaxDim.getValue();
if (!edit) {
Result.sender_name = Current.getAccount().name;
Result.sender_address = Current.getAccount().email;
Result.sender_name = Global.mainModule.getAccount().name;
Result.sender_address = Global.mainModule.getAccount().email;
}
}
};

View File

@@ -4,6 +4,7 @@ import Common.Database.Objects.DBObject;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import Common.Visual.Tables.TableRenderers;
import _VisualDVM.Global;
import _VisualDVM.ServerObjectsCache.ConfigurationCache;
import _VisualDVM.ServerObjectsCache.VisualCaches;
import Common.Visual.Windows.Dialog.DBObjectDialog;
@@ -111,6 +112,6 @@ public class DVMConfigurationDBTable extends iDBTable<DVMConfiguration> {
}
@Override
public boolean ShowEditObjectDialog(DBObject object) {
return (Current.getAccount().CheckAccessRights(((DVMConfiguration) object).sender_address, null)) ? super.ShowEditObjectDialog(object) : ViewObject(object);
return (Global.mainModule.getAccount().CheckAccessRights(((DVMConfiguration) object).sender_address, null)) ? super.ShowEditObjectDialog(object) : ViewObject(object);
}
}

View File

@@ -110,7 +110,7 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
}
@Override
public boolean isVisible() {
return (!DVMPackageDBTable.filterMyOnly || Current.getAccount().email.equals(sender_address)) &&
return (!DVMPackageDBTable.filterMyOnly || Global.mainModule.getAccount().email.equals(sender_address)) &&
(!DVMPackageDBTable.filterActive || state.isActive());
}
@Override

View File

@@ -4,6 +4,7 @@ import Common.Database.Objects.DBObject;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.Global;
import _VisualDVM.TestingSystem.DVM.DVMSettings.UI.DVMSettingsFields;
public class DVMSettingsDBTable extends iDBTable<DVMSettings> {
public DVMSettingsDBTable() {
@@ -141,6 +142,6 @@ public class DVMSettingsDBTable extends iDBTable<DVMSettings> {
}
@Override
public boolean ShowEditObjectDialog(DBObject object) {
return (Current.getAccount().CheckAccessRights(((DVMSettings) object).sender_address, null)) ? super.ShowEditObjectDialog(object) : ViewObject(object);
return (Global.mainModule.getAccount().CheckAccessRights(((DVMSettings) object).sender_address, null)) ? super.ShowEditObjectDialog(object) : ViewObject(object);
}
}

View File

@@ -4,6 +4,7 @@ import Common.Visual.TextField.StyledTextField;
import Common.Visual.Windows.Dialog.DialogFields;
import Visual_DVM_2021.Passes.PassCode;
import Common.Passes.Pass;
import _VisualDVM.Global;
import javax.swing.*;
import java.awt.*;
@@ -39,7 +40,7 @@ public class DVMSettingsFields implements DialogFields {
@Override
public void actionPerformed(ActionEvent e) {
Pass pass = Pass.passes.get(PassCode.PickCompilerOptions);
if (pass.Do(Current.getCompiler())) {
if (pass.Do(Global.mainModule.getCompiler())) {
tfFlags.setText((String)pass.target);
}
}
@@ -48,7 +49,7 @@ public class DVMSettingsFields implements DialogFields {
@Override
public void actionPerformed(ActionEvent e) {
Pass pass = Pass.passes.get(PassCode.PickCompilerEnvironmentsForTesting);
if (pass.Do(Current.getCompiler()))
if (pass.Do(Global.mainModule.getCompiler()))
tfEnvironments.setText((String)pass.target);
}
});

View File

@@ -52,7 +52,7 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
}
@Override
public boolean isVisible() {
return (!SapforPackageDBTable.filterMyOnly || Current.getAccount().email.equals(sender_address)) &&
return (!SapforPackageDBTable.filterMyOnly || Global.mainModule.getAccount().email.equals(sender_address)) &&
(!SapforPackageDBTable.filterActive || state.isActive())
;
}

View File

@@ -4,6 +4,7 @@ import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.riDBObject;
import Visual_DVM_2021.Passes.PassCode;
import _VisualDVM.Global;
import com.sun.org.glassfish.gmbal.Description;
public class SapforSettingsCommand extends riDBObject {
@Description("DEFAULT -1")
@@ -11,7 +12,7 @@ public class SapforSettingsCommand extends riDBObject {
public PassCode passCode = PassCode.SPF_RemoveDvmDirectives;
@Override
public boolean isVisible() {
return Current.HasSapforSettings() && (Current.getSapforSettings().id == sapforsettings_id);
return Global.mainModule.matchCurrentID(Current.SapforSettings,sapforsettings_id);
}
@Override
public void SynchronizeFields(DBObject src) {

View File

@@ -4,6 +4,7 @@ import _VisualDVM.Current;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.Global;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettings;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.UI.SapforSettingsCommandFields;
import Visual_DVM_2021.Passes.PassCode;
@@ -67,7 +68,7 @@ public class SapforSettingsCommandsDBTable extends iDBTable<SapforSettingsComman
@Override
public void ProcessResult() {
Result.passCode = (PassCode) fields.cbPassCode.getSelectedItem();
Result.sapforsettings_id = Current.getSapforSettings().id;
Result.sapforsettings_id = Global.mainModule.getSapforSettings().id;
}
};
}

View File

@@ -3,6 +3,7 @@ import Common.Current_;
import _VisualDVM.Current;
import Common.Visual.Trees.DataTree;
import Common.Visual.Trees.TreeRenderers;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import _VisualDVM.TestingSystem.SAPFOR.Json.SapforVersion_json;
@@ -60,7 +61,7 @@ public class SapforTasksPackageTree extends DataTree {
//---
if (o instanceof SapforVersion_json) {
SapforVersion_json version = (SapforVersion_json) o;
Current_.set(current, version);
Global.mainModule.set(current, version);
if (current.equals(Current.SapforEtalonVersion))
UI.getMainWindow().getTestingWindow().ShowCurrentSapforPackageVersionEtalon();
else

View File

@@ -5,6 +5,7 @@ import Common.Visual.Menus.VisualiserMenuItem;
import _VisualDVM.Current;
import Visual_DVM_2021.Passes.PassCode;
import Common.Passes.Pass;
import _VisualDVM.Global;
import javax.swing.*;
import java.awt.*;
@@ -21,7 +22,7 @@ public class AttachementsMenu extends StyledPopupMenu {
@Override
public void actionPerformed(ActionEvent e) {
try {
Desktop.getDesktop().open(Current.getProject().getAttachmentsDirectory());
Desktop.getDesktop().open(Global.mainModule.getProject().getAttachmentsDirectory());
} catch (Exception ex) {
Utils_.MainLog.PrintException(ex);
}

View File

@@ -1,6 +1,7 @@
package _VisualDVM.Visual.Menus.CredentialsBar;
import _VisualDVM.Current;
import Common.Visual.Controls.MenuBarButton;
import _VisualDVM.Global;
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
import Common.Visual.Fonts.VisualiserFonts;
import Visual_DVM_2021.Passes.PassCode;
@@ -42,10 +43,10 @@ public class CredentialsBar extends VisualiserMenuBar {
});
}
public void ShowMachine(){
MachineButton.setText(Current.getMachine().getURL());
MachineButton.setText(Global.mainModule.getMachine().getURL());
}
public void ShowUser(){
UserButton.setText(Current.getUser().login);
UserButton.setText(Global.mainModule.getUser().login);
}
public void ShowNoMachine(){
MachineButton.setText("?");

View File

@@ -1,5 +1,6 @@
package _VisualDVM.Visual.Menus.FileMenuBar;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Menus.LanguagesSubmenu;
import _VisualDVM.Visual.Menus.StylesSubmenu;
import _VisualDVM.Visual.Menus.TypesSubmenu;
@@ -19,10 +20,10 @@ public class FileSettingsMenu extends VisualiserMenu {
add(mLanguage = new LanguagesSubmenu() {
@Override
public void action(LanguageName languageName) {
if (Current.getFile().UpdateLanguage(languageName)) {
Current.getSapfor().ResetAllAnalyses();
Current.getFile().form.ShowLanguage();
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RefreshNode(Current.getFile().node);
if (Global.mainModule.getFile().UpdateLanguage(languageName)) {
Global.mainModule.getSapfor().ResetAllAnalyses();
Global.mainModule.getFile().form.ShowLanguage();
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RefreshNode(Global.mainModule.getFile().node);
}
}
});
@@ -31,9 +32,9 @@ public class FileSettingsMenu extends VisualiserMenu {
add(mStyle = new StylesSubmenu() {
@Override
public void action(LanguageStyle languageStyle) {
if (Current.getFile().UpdateStyle(languageStyle)) {
Current.getSapfor().ResetAllAnalyses();
Current.getFile().form.ShowStyle();
if (Global.mainModule.getFile().UpdateStyle(languageStyle)) {
Global.mainModule.getSapfor().ResetAllAnalyses();
Global.mainModule.getFile().form.ShowStyle();
}
}
});
@@ -42,22 +43,22 @@ public class FileSettingsMenu extends VisualiserMenu {
add(mType = new TypesSubmenu() {
@Override
public void action(FileType fileType) {
if (Current.getFile().UpdateType(fileType)) {
Current.getSapfor().ResetAllAnalyses();
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RefreshNode(Current.getFile().node);
Current.getFile().form.ShowType();
if (Global.mainModule.getFile().UpdateType(fileType)) {
Global.mainModule.getSapfor().ResetAllAnalyses();
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RefreshNode(Global.mainModule.getFile().node);
Global.mainModule.getFile().form.ShowType();
}
}
});
ShowType();
}
public void ShowLanguage() {
mLanguage.setText("Язык: " + Current.getFile().languageName.getDescription());
mLanguage.setText("Язык: " + Global.mainModule.getFile().languageName.getDescription());
}
public void ShowStyle() {
mStyle.setText("Стиль: " + Current.getFile().style.getDescription());
mStyle.setText("Стиль: " + Global.mainModule.getFile().style.getDescription());
}
public void ShowType() {
mType.setText("Тип: " + Current.getFile().fileType.getDescription());
mType.setText("Тип: " + Global.mainModule.getFile().fileType.getDescription());
}
}

View File

@@ -2,6 +2,7 @@ package _VisualDVM.Visual.Menus;
import Common.Visual.Menus.StyledPopupMenu;
import Common.Visual.Menus.VisualiserMenuItem;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.Files.LanguageStyle;
import javax.swing.*;
@@ -14,9 +15,9 @@ public class FileStyleMenu extends StyledPopupMenu {
new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
if (Current.getFile().UpdateStyle(s)) {
Current.getSapfor().ResetAllAnalyses();
Current.getFile().form.ShowStyle();
if (Global.mainModule.getFile().UpdateStyle(s)) {
Global.mainModule.getSapfor().ResetAllAnalyses();
Global.mainModule.getFile().form.ShowStyle();
}
}
});

View File

@@ -3,6 +3,7 @@ import Common.Utils.Utils_;
import Common.Visual.Menus.TextEditorMenu;
import Common.Visual.Menus.VisualiserMenuItem;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Editor.CaretInfo;
import _VisualDVM.Utils;
import _VisualDVM.ProjectData.Files.DBProjectFile;
@@ -117,7 +118,7 @@ public class MainEditorMenu extends TextEditorMenu {
String new_ = "";
String[] data = selectedText.split("\n");
int i = 0;
switch (Current.getFile().languageName) {
switch (Global.mainModule.getFile().languageName) {
case fortran:
for (String line : data) {
if (!line.startsWith("!")) {
@@ -153,7 +154,7 @@ public class MainEditorMenu extends TextEditorMenu {
String new_ = "";
String[] data = selectedText.split("\n");
int i = 0;
switch (Current.getFile().languageName) {
switch (Global.mainModule.getFile().languageName) {
case fortran:
for (String line : data) {
if (line.startsWith("!")) {
@@ -189,7 +190,7 @@ public class MainEditorMenu extends TextEditorMenu {
@Override
public void actionPerformed(ActionEvent e) {
try {
Current.getSapfor().UpdateProjectFiles(false);
Global.mainModule.getSapfor().UpdateProjectFiles(false);
} catch (Exception ex) {
Utils_.MainLog.PrintException(ex);
}
@@ -236,14 +237,14 @@ public class MainEditorMenu extends TextEditorMenu {
" . Выполните проход \"Граф процедур \"");
return;
}
if (Current.getSapfor().isIntrinsic(selectedText)) {
if (Global.mainModule.getSapfor().isIntrinsic(selectedText)) {
m_inline.setText("Невозможно подставить вызов процедуры " + Utils_.Brackets(selectedText) +
" . Процедура является стандартной.");
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + Utils_.Brackets(selectedText) +
" . Процедура является стандартной.");
return;
}
call = Current.getFile().find_func_call(selectedText);
call =Global.mainModule.getFile().find_func_call(selectedText);
if (call == null) {
m_inline.setText("Невозможно подставить вызов процедуры " + Utils_.Brackets(selectedText) +
" . Вызов не найден в текущей строке.");
@@ -251,7 +252,7 @@ public class MainEditorMenu extends TextEditorMenu {
" . Объявление процедуры уже находится в текущей строке.");
return;
}
decl = Current.getProject().allFunctions.get(call.funcName);
decl = Global.mainModule.getProject().allFunctions.get(call.funcName);
if (decl.type.equals(FunctionType.NotFound)) {
m_inline.setText("Невозможно подставить вызов процедуры " + Utils_.Brackets(selectedText) +
" . Объявление процедуры не найдено в проекте.");
@@ -281,11 +282,11 @@ public class MainEditorMenu extends TextEditorMenu {
m_gotoHeader.setText("Невозможно перейти к заголовочному файлу. Выполните проход \"Поиск зависимостей по включению\"");
return;
}
if (!Current.getFile().relativeHeaders.containsKey(header_)) {
if (!Global.mainModule.getFile().relativeHeaders.containsKey(header_)) {
m_gotoHeader.setText("Невозможно перейти к заголовочному файлу " + Utils_.Brackets(header_) + " . Файл не найден среди включений текущего файла.");
return;
}
header = Current.getFile().relativeHeaders.get(header_);
header = Global.mainModule.getFile().relativeHeaders.get(header_);
m_gotoHeader.setText("Переход к заголовочному файлу " + Utils_.Brackets(header_));
m_gotoHeader.setEnabled(true);
}
@@ -298,7 +299,7 @@ public class MainEditorMenu extends TextEditorMenu {
"Выполните проход \"Граф циклов\"");
return;
}
loop = Current.getFile().find_current_loop();
loop = Global.mainModule.getFile().find_current_loop();
if (loop == null) {
m_loop_union.setText("Невозможно объединить цикл в текущей строке со следующим. Не найдено циклов в текущей строке.");
return;
@@ -333,7 +334,7 @@ public class MainEditorMenu extends TextEditorMenu {
m_add_lines_to_region.setText("Добавить строки в область");
m_remove_lines_from_region.setText("Удалить строки из области");
}
if (Current.getSapfor().OldFiles.isEmpty()) {
if (Global.mainModule.getSapfor().OldFiles.isEmpty()) {
m_undo.setEnabled(false);
m_undo.setText("Невозможно отменить последнюю модификацию. Модификации отсутствуют.");
} else {

View File

@@ -30,7 +30,7 @@ public class ProjectFilesMenu extends GraphMenu {
@Override
public void actionPerformed(ActionEvent e) {
try {
Desktop.getDesktop().open(Current.getProject().Home);
Desktop.getDesktop().open(Global.mainModule.getProject().Home);
} catch (Exception ex) {
Utils_.MainLog.PrintException(ex);
}
@@ -49,8 +49,8 @@ public class ProjectFilesMenu extends GraphMenu {
add(new VisualiserMenuItem("Удалить текущий проект", "/icons/Delete.png") {
{
addActionListener(e -> {
if (Current.HasProject()) {
UI.getVersionsWindow().getVersionsForm().getTree().SelectNode(Current.getProject().node);
if (Global.mainModule.HasProject()) {
UI.getVersionsWindow().getVersionsForm().getTree().SelectNode(Global.mainModule.getProject().node);
Pass.passes.get(PassCode.DeleteVersion).Do();
}
});
@@ -62,7 +62,7 @@ public class ProjectFilesMenu extends GraphMenu {
m_multiselection.addActionListener(e -> {
Global.files_multiselection = !Global.files_multiselection;
m_multiselection.setIcon(Utils_.getIcon(Global.files_multiselection ? "/icons/Pick.png" : "/icons/NotPick.png"));
Current.getProject().SelectAllFiles(false);
Global.mainModule.getProject().SelectAllFiles(false);
UI.getMainWindow().getProjectWindow().RefreshProjectFiles();
//-
@@ -72,13 +72,13 @@ public class ProjectFilesMenu extends GraphMenu {
//-
m_select_all = new StableMenuItem("Выбрать всё", "/icons/SelectAll.png");
m_select_all.addActionListener(e -> {
Current.getProject().SelectAllFiles(true);
Global.mainModule.getProject().SelectAllFiles(true);
tree.updateUI();
});
add(m_select_all);
m_unselect_all = new StableMenuItem("Отменить всё", "/icons/UnselectAll.png");
m_unselect_all.addActionListener(e -> {
Current.getProject().SelectAllFiles(false);
Global.mainModule.getProject().SelectAllFiles(false);
tree.updateUI();
});
add(m_unselect_all);

View File

@@ -20,8 +20,8 @@ public class ProjectSettingsMenu extends VisualiserMenu {
add(mLanguage = new LanguagesSubmenu() {
@Override
public void action(LanguageName languageName) {
if (Current.getProject().UpdateLanguage(languageName)) {
Current.getSapfor().ResetAllAnalyses();
if (Global.mainModule.getProject().UpdateLanguage(languageName)) {
Global.mainModule.getSapfor().ResetAllAnalyses();
ShowLanguage();
}
}
@@ -31,7 +31,7 @@ public class ProjectSettingsMenu extends VisualiserMenu {
add(mStyle = new StylesSubmenu() {
@Override
public void action(LanguageStyle languageStyle) {
if (Current.getProject().UpdateStyle(languageStyle))
if (Global.mainModule.getProject().UpdateStyle(languageStyle))
ShowStyle();
}
});
@@ -66,9 +66,9 @@ public class ProjectSettingsMenu extends VisualiserMenu {
add((Global.mainModule.getDb()).settings.get(SettingName.GCOVLimit).getMenuItem());
}
public void ShowLanguage() {
mLanguage.setText("Язык: " + Current.getProject().languageName.getDescription());
mLanguage.setText("Язык: " + Global.mainModule.getProject().languageName.getDescription());
}
public void ShowStyle() {
mStyle.setText("Стиль: " + Current.getProject().style.getDescription());
mStyle.setText("Стиль: " + Global.mainModule.getProject().style.getDescription());
}
}

View File

@@ -3,6 +3,7 @@ import Common.Current_;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Menus.VisualiserMenu;
import Common.Visual.Fonts.VisualiserFonts;
import _VisualDVM.Visual.UI;
@@ -21,7 +22,7 @@ public class ProjectViewMenu extends VisualiserMenu {
setIcon(Utils_.getIcon(view.getIcon()));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
addActionListener(e -> {
Current_.set(Current.ProjectView, view);
Global.mainModule.set(Current.ProjectView, view);
UI.getMainWindow().getProjectWindow().ShowProjectView();
});
}

View File

@@ -5,6 +5,7 @@ import Common.Visual.Menus.VisualiserMenuItem;
import Common.Visual.Selectable;
import Common.Visual.Trees.DataTree;
import Common.Visual.Trees.SelectableTree;
import _VisualDVM.Global;
import javax.swing.*;
import java.awt.event.ActionEvent;
@@ -41,7 +42,7 @@ public abstract class SelectionTreeMenu extends GraphMenu<DataTree> {
m_select_for_current.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
Object o = Current_.get(tree.getCurrent());
Object o = Global.mainModule.get(tree.getCurrent());
if (o instanceof Selectable) {
((Selectable) o).SelectAllChildren(true);
}
@@ -54,7 +55,7 @@ public abstract class SelectionTreeMenu extends GraphMenu<DataTree> {
m_unselect_for_current.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
Object o = Current_.get(tree.getCurrent());
Object o = Global.mainModule.get(tree.getCurrent());
if (o instanceof Selectable) {
((Selectable) o).SelectAllChildren(false);
}
@@ -68,7 +69,7 @@ public abstract class SelectionTreeMenu extends GraphMenu<DataTree> {
public abstract void SelectAll(boolean select);
@Override
public void CheckElementsVisibility() {
Object current = Current_.get(tree.getCurrent());
Object current = Global.mainModule.get(tree.getCurrent());
if ((current != null) && (current.getClass().equals(getTargetClass()))) {
String name = ((Selectable) current).getSelectionText();
m_select_for_current.setText("Выбрать всё для " +

View File

@@ -21,7 +21,7 @@ public class VersionsMenu extends GraphMenu<DataTree> {
m_multiselection.addActionListener(e -> {
Global.versions_multiselection = !Global.versions_multiselection;
m_multiselection.setIcon(Utils_.getIcon(Global.versions_multiselection ? "/icons/Pick.png" : "/icons/NotPick.png"));
Current.getRoot().SelectAllVersions(false);
Global.mainModule.getRoot().SelectAllVersions(false);
UI.getVersionsWindow().getVersionsForm().getTree().updateUI();
});
add(m_multiselection);
@@ -30,13 +30,13 @@ public class VersionsMenu extends GraphMenu<DataTree> {
//-
m_select_all = new StableMenuItem("Выбрать всё, кроме резервных копий","/icons/SelectAll.png");
m_select_all.addActionListener(e -> {
Current.getRoot().SelectAllVersions(true);
Global.mainModule.getRoot().SelectAllVersions(true);
tree.updateUI();
});
add(m_select_all);
m_unselect_all = new StableMenuItem("Отменить всё","/icons/UnselectAll.png");
m_unselect_all.addActionListener(e -> {
Current.getRoot().SelectAllVersions(false);
Global.mainModule.getRoot().SelectAllVersions(false);
tree.updateUI();
});
add(m_unselect_all);

View File

@@ -266,7 +266,7 @@ public class UI {
tabs.setTitleAt(i, flag ? tabs.getToolTipTextAt(i) : "");
}
public static void CreateVersionsWindow() {
versionsWindow = new VersionsForm(Current.getRoot());
versionsWindow = new VersionsForm(Global.mainModule.getRoot());
}
//-
public static void ShowSearchForm(boolean replace) {

View File

@@ -1,5 +1,6 @@
package _VisualDVM.Visual.Windows;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Visual.Interface.AnalysisWindow;
import javax.swing.*;
@@ -16,7 +17,7 @@ public class AnalysisForm implements AnalysisWindow {
private JPanel regionsPanel;
public AnalysisForm() {
LoadSplitters();
Current.getProject().parallelRegions.mountUI(regionsPanel);
Global.mainModule.getProject().parallelRegions.mountUI(regionsPanel);
}
@Override
public JPanel getContent() {
@@ -24,7 +25,7 @@ public class AnalysisForm implements AnalysisWindow {
}
@Override
public void ShowProjectMaxDim() {
l_maxdim.setText("Наибольшая размерность DVM-шаблона: " + Current.getProject().maxdim);
l_maxdim.setText("Наибольшая размерность DVM-шаблона: " + Global.mainModule.getProject().maxdim);
}
@Override
public void ShowNoProjectMaxDim() {
@@ -32,9 +33,9 @@ public class AnalysisForm implements AnalysisWindow {
}
@Override
public void ShowMetrics() {
l_lines.setText("Общее количество строк кода: " + Current.getProject().LinesCount());
l_spf_dirs.setText("Всего объявлено SPF директив: " + Current.getProject().SPFCount());
l_dvm_dirs.setText("Всего объявлено DVM директив: " + Current.getProject().DVMCount());
l_lines.setText("Общее количество строк кода: " + Global.mainModule.getProject().LinesCount());
l_spf_dirs.setText("Всего объявлено SPF директив: " + Global.mainModule.getProject().SPFCount());
l_dvm_dirs.setText("Всего объявлено DVM директив: " + Global.mainModule.getProject().DVMCount());
}
@Override
public void ShowNoMetrics() {
@@ -44,22 +45,22 @@ public class AnalysisForm implements AnalysisWindow {
}
@Override
public void ShowRegions() {
Current.getProject().parallelRegions.ShowUI();
Global.mainModule.getProject().parallelRegions.ShowUI();
}
@Override
public void ShowNoRegions() {
Current.getProject().parallelRegions.ClearUI();
Global.mainModule.getProject().parallelRegions.ClearUI();
}
@Override
public void ShowLoopsCount() {
l_loops.setText("Общее количество циклов: " + Current.getProject().LoopsCount());
l_loops.setText("Общее количество циклов: " + Global.mainModule.getProject().LoopsCount());
}
@Override
public void ShowFunctionsCount() {
l_functions.setText("Всего объявлено процедур: " + Current.getProject().FunctionsCount());
l_functions.setText("Всего объявлено процедур: " + Global.mainModule.getProject().FunctionsCount());
}
@Override
public void ShowArraysCount() {
l_arrays.setText(" Всего объявлено массивов: " + Current.getProject().ArraysCount());
l_arrays.setText(" Всего объявлено массивов: " + Global.mainModule.getProject().ArraysCount());
}
}

View File

@@ -1,6 +1,7 @@
package _VisualDVM.Visual.Windows;
import _VisualDVM.Current;
import Common.Visual.TextField.StyledTextField;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
import _VisualDVM.Visual.Interface.ArraysWindow;
@@ -21,8 +22,8 @@ public class ArraysForm implements ArraysWindow {
private JPanel savedArraysBackground;
public ArraysForm(){
LoadSplitters();
Current.getProject().declaratedArrays.mountUI(arraysPanel);
Current.getProject().db.savedArrays.mountUI(savedArraysPanel);
Global.mainModule.getProject().declaratedArrays.mountUI(arraysPanel);
Global.mainModule.getProject().db.savedArrays.mountUI(savedArraysPanel);
//--
filterName.setText(ProjectArray.filterName);
filterName.getDocument().addDocumentListener(new DocumentListener() {
@@ -115,13 +116,13 @@ public class ArraysForm implements ArraysWindow {
}
@Override
public void ShowArrays() {
Current.getProject().declaratedArrays.ShowUI();
Current.getProject().db.savedArrays.ShowUI();
Global.mainModule.getProject().declaratedArrays.ShowUI();
Global.mainModule.getProject().db.savedArrays.ShowUI();
}
@Override
public void ShowNoArrays() {
Current.getProject().declaratedArrays.ClearUI();
Current.getProject().db.savedArrays.ClearUI();
Global.mainModule.getProject().declaratedArrays.ClearUI();
Global.mainModule.getProject().db.savedArrays.ClearUI();
}
private void createUIComponents() {
// TODO: place custom component creation code here

View File

@@ -46,8 +46,8 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
}
@Override
public void changedUpdate(DocumentEvent e) {
if (!Current.getBugReport().state.equals(BugReportState.draft))
Current.getBugReport().descriptionAdditionDraft =
if (!Global.mainModule.getBugReport().state.equals(BugReportState.draft))
Global.mainModule.getBugReport().descriptionAdditionDraft =
BugReportDescriptionAddition.getText();
}
};
@@ -60,8 +60,8 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
}
@Override
public void changedUpdate(DocumentEvent e) {
if (!Current.getBugReport().state.equals(BugReportState.draft))
Current.getBugReport().commentAdditionDraft = BugReportCommentAddition.getText();
if (!Global.mainModule.getBugReport().state.equals(BugReportState.draft))
Global.mainModule.getBugReport().commentAdditionDraft = BugReportCommentAddition.getText();
}
};
DocumentListener descriptionListener = new DocumentListener() {
@@ -73,8 +73,8 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
}
@Override
public void changedUpdate(DocumentEvent e) {
if (Current.getBugReport().state.equals(BugReportState.draft))
Current.getBugReport().description =
if (Global.mainModule.getBugReport().state.equals(BugReportState.draft))
Global.mainModule.getBugReport().description =
BugReportDescription.getText();
Global.componentsServer.db.bugReports.RefreshUI();
}
@@ -88,8 +88,8 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
}
@Override
public void changedUpdate(DocumentEvent e) {
if (Current.getBugReport().state.equals(BugReportState.draft))
Current.getBugReport().comment = BugReportComment.getText();
if (Global.mainModule.getBugReport().state.equals(BugReportState.draft))
Global.mainModule.getBugReport().comment = BugReportComment.getText();
}
};
//-
@@ -436,10 +436,10 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
}
@Override
public void ShowAccount() {
lAccountName.setText(Utils_.Brackets(Current.getAccount().name));
lAccountMail.setText(Utils_.Brackets(Current.getAccount().email));
lAccountRole.setText(Utils_.Brackets(Current.getAccount().role.getDescription()));
switch (Current.getAccount().role) {
lAccountName.setText(Utils_.Brackets(Global.mainModule.getAccount().name));
lAccountMail.setText(Utils_.Brackets(Global.mainModule.getAccount().email));
lAccountRole.setText(Utils_.Brackets(Global.mainModule.getAccount().role.getDescription()));
switch (Global.mainModule.getAccount().role) {
case Undefined:
/// UI.Clear(accountPanel);
// accountPanel.add(new CallbackWelcomeForm().content);
@@ -553,7 +553,7 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
public void ShowCurrentBugReport() {
SwitchListeners(false);
// currentBugReportTabs.setSelectedIndex(0);
BugReport target = Current.getBugReport();
BugReport target = Global.mainModule.getBugReport();
BugReportInterface.CheckSubscribers(target);
Global.componentsServer.db.subscribers.ShowUI();
//-
@@ -576,12 +576,12 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
if (target.state.equals(BugReportState.draft)) {
ShowDraft();
} else {
switch (Current.getAccount().role) {
switch (Global.mainModule.getAccount().role) {
case User:
if (Current.getAccount().email.equalsIgnoreCase(target.sender_address)) {
if (Global.mainModule.getAccount().email.equalsIgnoreCase(target.sender_address)) {
ShowSender(); //отправитель.может делать с багом все.
} else {
if (Current.getAccount().email.equalsIgnoreCase(target.executor_address)) {
if (Global.mainModule.getAccount().email.equalsIgnoreCase(target.executor_address)) {
ShowUserExecutor(); //исполнитель. может менять прогресс и дополнять комментарий.
} else ShowUser(); //недоступно ничего. и баг ему невидим. но на всякий случай.
}

View File

@@ -1,6 +1,7 @@
package _VisualDVM.Visual.Windows;
import _VisualDVM.Current;
import Common.Visual.Windows.Dialog.Text.ComboTextDialog;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import java.util.Vector;
@@ -15,7 +16,7 @@ public class CombineFilesDialog extends ComboTextDialog {
String fileName = (String) fields.getSelectedItem();
// тут 2 случая. если имя файла совпадает с 1 из существующих, то все хорошо.
//если нет. тогда проверяем отсуствие слешей и полная валидация имени одиночного файла.
Vector<String> files_order = Current.getProject().files_order;
Vector<String> files_order = Global.mainModule.getProject().files_order;
if (!files_order.contains(fileName))
Utils.validateFileShortNewName(fileName, Log);
}

View File

@@ -5,6 +5,7 @@ import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
import _VisualDVM.Visual.Editor.BaseEditor;
import _VisualDVM.Visual.Controls.ShortLabel;
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
@@ -76,8 +77,8 @@ public abstract class ComparisonForm<T> {
public void ApplyObject() {
RemoveObject();
TextLog log = new TextLog();
if (Current_.Check(log, getCurrentObjectName())) {
object = (T) Current_.get(getCurrentObjectName());
if (Global.mainModule.Check(log, getCurrentObjectName())) {
object = (T) Global.mainModule.get(getCurrentObjectName());
applyObject();
showObject();
} else

View File

@@ -2,6 +2,7 @@ package _VisualDVM.Visual.Windows;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.TextField.StyledTextField;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.SapforData.Functions.UI.Graph.FunctionsGraphForm;
import _VisualDVM.ProjectData.SapforData.Functions.UI.Graph.FunctionsGraphUI;
import Visual_DVM_2021.Passes.All.SPF_GetGraphFunctionPositions;
@@ -63,7 +64,7 @@ public class FunctionsForm implements FunctionsWindow {
}
@Override
public void ShowCurrentFunction() {
lCurrentFunction.setText(Current.getFunction().funcName);
lCurrentFunction.setText(Global.mainModule.getFunction().funcName);
}
@Override
public void ShowNoCurrentFunction() {
@@ -74,9 +75,9 @@ public class FunctionsForm implements FunctionsWindow {
ShowExternalFilter.setSelected(SPF_GetGraphFunctionPositions.showExternalFunctions);
ShowUnreachableFilter.setSelected(SPF_GetGraphFunctionPositions.showUnreachableFunctions);
//-
sIterations.setValue(Current.getProject().fgIterations);
sResistance.setValue(Current.getProject().fgResistance);
sScreen.setValue(Current.getProject().fgScreen);
sIterations.setValue(Global.mainModule.getProject().fgIterations);
sResistance.setValue(Global.mainModule.getProject().fgResistance);
sScreen.setValue(Global.mainModule.getProject().fgScreen);
//-
cbShowByCurrentFunction.setSelected(SPF_GetGraphFunctionPositions.showByCurrentFunction);
ShowIn.setSelected(SPF_GetGraphFunctionPositions.showIn);
@@ -103,28 +104,28 @@ public class FunctionsForm implements FunctionsWindow {
Pass.passes.get(PassCode.SaveGraph).Do();
}
});
sIterations.setModel(new SpinnerNumberModel(Current.getProject().fgIterations,
sIterations.setModel(new SpinnerNumberModel(Global.mainModule.getProject().fgIterations,
100, 5000, 100
));
sResistance.setModel(new SpinnerNumberModel(Current.getProject().fgResistance,
sResistance.setModel(new SpinnerNumberModel(Global.mainModule.getProject().fgResistance,
10, 5000, 50
));
sScreen.setModel(new SpinnerNumberModel(Current.getProject().fgScreen,
sScreen.setModel(new SpinnerNumberModel(Global.mainModule.getProject().fgScreen,
0.25, 2.0, 0.05
));
sDepth.setModel(new SpinnerNumberModel(1,
0, 64, 1
));
UI_.MakeSpinnerRapid(sIterations, e -> {
Current.getProject().UpdatefgIterations((int) sIterations.getValue());
Global.mainModule.getProject().UpdatefgIterations((int) sIterations.getValue());
FunctionsGraphUI.ffTimer.restart();
});
UI_.MakeSpinnerRapid(sResistance, e -> {
Current.getProject().UpdatefgResistance((int) sResistance.getValue());
Global.mainModule.getProject().UpdatefgResistance((int) sResistance.getValue());
FunctionsGraphUI.ffTimer.restart();
});
UI_.MakeSpinnerRapid(sScreen, e -> {
Current.getProject().UpdatefgScreen((double) sScreen.getValue());
Global.mainModule.getProject().UpdatefgScreen((double) sScreen.getValue());
FunctionsGraphUI.ffTimer.restart();
});
UI_.MakeSpinnerRapid(sDepth, e -> {

View File

@@ -83,9 +83,9 @@ public class MainForm extends Form implements MainWindow {
}
private void InstallProjectPanel() {
globalTabs.insertTab("", null,
(projectForm = new ProjectForm()).content, Current.getProject().description, 0);
(projectForm = new ProjectForm()).content,Global.mainModule.getProject().description, 0);
globalTabs.setTabComponentAt(0,
new TabToolBar("Проект: " + Current.getProject().name, PassCode.CloseCurrentProject) {
new TabToolBar("Проект: " + Global.mainModule.getProject().name, PassCode.CloseCurrentProject) {
@Override
public void leftMouseAction() {
globalTabs.setSelectedIndex(0);

View File

@@ -123,7 +123,7 @@ public class ProjectForm implements FormWithSplitters, ProjectWindow {
}
@Override
public void ShowProjectSapforLog() {
logText.setText(Current.getProject().Log);
logText.setText(Global.mainModule.getProject().Log);
logText.setCaretPosition(0);
}
@Override
@@ -154,9 +154,9 @@ public class ProjectForm implements FormWithSplitters, ProjectWindow {
//filesTabs.setTabComponentAt(0,
// new TabToolBar(Current.getFile().name, PassCode_2021.CloseCurrentFile));
// projectTabs.setTitleAt(0, "Файл: " + Current.getFile().name);
fileBackground.add((Current.getFile().form = new FileForm(Current.getFile())).getContent());
fileBackground.add((Global.mainModule.getFile().form = new FileForm(Global.mainModule.getFile())).getContent());
projectTabs.setTabComponentAt(0,
new TabToolBar("Файл: " + Current.getFile().name, PassCode.CloseCurrentFile) {
new TabToolBar("Файл: " + Global.mainModule.getFile().name, PassCode.CloseCurrentFile) {
@Override
public void leftMouseAction() {
projectTabs.setSelectedIndex(0);
@@ -178,10 +178,10 @@ public class ProjectForm implements FormWithSplitters, ProjectWindow {
@Override
public void GotoFile(String fileName, int line, boolean focus) {
if (focus) FocusFile();
if (Current.HasFile() && Current.getFile().name.equals(fileName))
Current.getFile().form.getEditor().gotoLine(line);
else if (Current.getProject().db.files.containsKey(fileName)) {
DBProjectFile targetFile = Current.getProject().db.files.get(fileName);
if (Global.mainModule.HasFile() && Global.mainModule.getFile().name.equals(fileName))
Global.mainModule.getFile().form.getEditor().gotoLine(line);
else if (Global.mainModule.getProject().db.files.containsKey(fileName)) {
DBProjectFile targetFile = Global.mainModule.getProject().db.files.get(fileName);
targetFile.UpdateLastLine(line);
Pass.passes.get(PassCode.OpenCurrentFile).Do(targetFile);
}
@@ -229,17 +229,17 @@ public class ProjectForm implements FormWithSplitters, ProjectWindow {
@Override
public void RefreshProjectTreeAndMessages() {
RefreshProjectFiles();
DBProjectFile badFile = Current.getProject().getFirstBadFile();
DBProjectFile badFile = Global.mainModule.getProject().getFirstBadFile();
if (badFile != null) {
Pass.passes.get(PassCode.OpenCurrentFile).Do(badFile);
UI.getMainWindow().FocusProject();
UI.getMainWindow().getProjectWindow().FocusFile();
}
//-
if (Current.HasFile()) {
Current.getFile().form.ShowMessages();
if (badFile != null && badFile.equals(Current.getFile()))
Current.getFile().form.ShowFirstError();
if (Global.mainModule.HasFile()) {
Global.mainModule.getFile().form.ShowMessages();
if (badFile != null && badFile.equals(Global.mainModule.getFile()))
Global.mainModule.getFile().form.ShowFirstError();
}
}
@Override
@@ -255,7 +255,7 @@ public class ProjectForm implements FormWithSplitters, ProjectWindow {
@Override
public void ShowProjectView() {
UI_.Clear(projectViewPanel);
ProjectView view = Current.getProjectView();
ProjectView view = Global.mainModule.getProjectView();
menuBar.getProjectViewMenu().setToolTipText(view.getDescription());
menuBar.getProjectViewMenu().setIcon(Utils_.getIcon(view.getIcon()));
switch (view) {

View File

@@ -3,6 +3,7 @@ import Common.Current_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
import _VisualDVM.Visual.Controls.ShortLabel;
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
import _VisualDVM.Visual.UI;
@@ -69,8 +70,8 @@ public class SapforPackagesComparisonForm {
RemoveObject();
//---
TextLog log = new TextLog();
if (Current_.Check(log, Current.SapforPackage)) {
object = Current.getSapforPackage();
if (Global.mainModule.Check(log, Current.SapforPackage)) {
object = Global.mainModule.getSapforPackage();
if (object.isLoaded() || (Pass.passes.get(PassCode.DownloadSapforPackage).Do(object))) {
showObject();
}

View File

@@ -5,6 +5,7 @@ import Common.Visual.Windows.Form;
import _VisualDVM.Current;
import Common.Visual.TextField.StyledTextField;
import Common.Visual.Trees.StyledTree;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import Visual_DVM_2021.Passes.PassCode;
import Common.Passes.Pass;
@@ -172,8 +173,8 @@ public class SearchReplaceForm extends Form {
DefaultMutableTreeNode selectedFile = (DefaultMutableTreeNode) getLastSelectedPathComponent();
if (selectedFile != null) {
Pair<String, Long> info = (Pair<String, Long>) selectedFile.getUserObject();
if (Current.getProject().db.files.containsKey(info.getKey())) {
Pass.passes.get(PassCode.OpenCurrentFile).Do(Current.getProject().db.files.get(info.getKey()));
if (Global.mainModule.getProject().db.files.containsKey(info.getKey())) {
Pass.passes.get(PassCode.OpenCurrentFile).Do(Global.mainModule.getProject().db.files.get(info.getKey()));
//--->>>
replaceOn.setSelected(false);
setMode(false);
@@ -195,7 +196,7 @@ public class SearchReplaceForm extends Form {
super.Show();
//------->>
showNoFilesMatches();
if (lastProjectPath.equals(Current.getProject().Home.getAbsolutePath()))
if (lastProjectPath.equals(Global.mainModule.getProject().Home.getAbsolutePath()))
showFilesMatches();
else
dropFilesMatches();
@@ -238,8 +239,8 @@ public class SearchReplaceForm extends Form {
public void actionPerformed(ActionEvent e) {
try {
showNoFilesMatches();
lastProjectPath = Current.getProject().Home.getAbsolutePath();
matches = Current.getProject().getMatches(
lastProjectPath = Global.mainModule.getProject().Home.getAbsolutePath();
matches = Global.mainModule.getProject().getMatches(
tfFind.getText(),
registerOn.isSelected(),
wholeWordOn.isSelected());

View File

@@ -225,13 +225,13 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
}
@Override
public void ShowCurrentCompiler() {
String title = (Current.HasCompiler() && Current.getCompiler().type.equals(CompilerType.dvm)) ?
"DVM система: " + Current.getCompiler().description : "DVM система: ?";
String title = (Global.mainModule.HasCompiler() && Global.mainModule.getCompiler().type.equals(CompilerType.dvm)) ?
"DVM система: " + Global.mainModule.getCompiler().description : "DVM система: ?";
testingTabs.setTitleAt(0, title);
}
@Override
public void ShowCurrentServerSapfor() {
testingTabs.setTitleAt(2, "SAPFOR: " + Current.getServerSapfor().version);
testingTabs.setTitleAt(2, "SAPFOR: " + Global.mainModule.getServerSapfor().version);
}
@Override
public void ShowNoServerSapfor() {
@@ -271,7 +271,7 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
testingTabs.setSelectedIndex(3);
}
public void RestoreLastCredentials() {
Credentials credentials = (Credentials) Current_.get(Current.Credentials);
Credentials credentials = Global.mainModule.getCredentials();
if (credentials.machine_id != CommonConstants.Nan) {
if (Global.mainModule.getDb().machines.containsKey(credentials.machine_id)) {
(Global.mainModule.getDb()).machines.ShowUI(credentials.machine_id);

View File

@@ -2,6 +2,7 @@ package _VisualDVM.Visual.Windows;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Visual.Trees.TreeForm;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.SapforData.Arrays.UI.DimensionsTableForm;
import _VisualDVM.ProjectData.SapforData.Arrays.UI.RulesTree;
import _VisualDVM.Visual.Interface.VariantsWindow;
@@ -28,13 +29,13 @@ public class VariantsForm implements VariantsWindow {
//--
public VariantsForm() {
LoadSplitters();
Current.getProject().parallelVariants.mountUI(variantsPanel);
Global.mainModule.getProject().parallelVariants.mountUI(variantsPanel);
//-
BDistributed.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Current.getProject().SwitchFilterDistributed();
BDistributed.setIcon(Utils_.getIcon(Current.getProject().f_distributed() ? "/icons/Pick.png" : "/icons/NotPick.png"));
Global.mainModule.getProject().SwitchFilterDistributed();
BDistributed.setIcon(Utils_.getIcon(Global.mainModule.getProject().f_distributed() ? "/icons/Pick.png" : "/icons/NotPick.png"));
ShowVariantsFilter();
ShowFilteredVariantsCount();
}
@@ -42,8 +43,8 @@ public class VariantsForm implements VariantsWindow {
bMultiplied.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Current.getProject().SwitchFilterMultiplied();
bMultiplied.setIcon(Utils_.getIcon(Current.getProject().f_multiplied() ? "/icons/Pick.png" : "/icons/NotPick.png"));
Global.mainModule.getProject().SwitchFilterMultiplied();
bMultiplied.setIcon(Utils_.getIcon(Global.mainModule.getProject().f_multiplied() ? "/icons/Pick.png" : "/icons/NotPick.png"));
ShowVariantsFilter();
ShowFilteredVariantsCount();
}
@@ -68,8 +69,8 @@ public class VariantsForm implements VariantsWindow {
}
@Override
public void ShowVariantsFilterButtons() {
BDistributed.setIcon(Utils_.getIcon(Current.getProject().f_distributed() ? "/icons/Pick.png" : "/icons/NotPick.png"));
bMultiplied.setIcon(Utils_.getIcon(Current.getProject().f_multiplied() ? "/icons/Pick.png" : "/icons/NotPick.png"));
BDistributed.setIcon(Utils_.getIcon(Global.mainModule.getProject().f_distributed() ? "/icons/Pick.png" : "/icons/NotPick.png"));
bMultiplied.setIcon(Utils_.getIcon(Global.mainModule.getProject().f_multiplied() ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
@Override
public void ShowVariantsFilter() {
@@ -81,11 +82,11 @@ public class VariantsForm implements VariantsWindow {
}
@Override
public void ShowFilteredVariantsCount() {
VisibleVariantsCount.setText(String.valueOf(Current.getProject().getFilteredVariantsCount()));
VisibleVariantsCount.setText(String.valueOf(Global.mainModule.getProject().getFilteredVariantsCount()));
}
@Override
public void ShowTotalVariantsCount() {
TotalVariantsCount.setText(String.valueOf(Current.getProject().getTotalVariantsCount()));
TotalVariantsCount.setText(String.valueOf(Global.mainModule.getProject().getTotalVariantsCount()));
}
@Override
public void ShowCheckedVariantsCount() {
@@ -93,15 +94,15 @@ public class VariantsForm implements VariantsWindow {
}
@Override
public void ShowVariants() {
Current.getProject().parallelVariants.ShowUI();
Global.mainModule.getProject().parallelVariants.ShowUI();
}
@Override
public void RefreshVariants() {
Current.getProject().parallelVariants.RefreshUI();
Global.mainModule.getProject().parallelVariants.RefreshUI();
}
@Override
public void ShowNoVariants() {
Current.getProject().parallelVariants.ClearUI();
Global.mainModule.getProject().parallelVariants.ClearUI();
}
@Override
public void ShowNoCheckedVariantsCount() {