339 lines
12 KiB
Java
339 lines
12 KiB
Java
package _VisualDVM;
|
|
import Common.MainModule_;
|
|
import Common.Passes.Pass;
|
|
import Common.Utils.Vector_;
|
|
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.Settings.SettingName;
|
|
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
|
|
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
|
|
import _VisualDVM.GlobalData.User.User;
|
|
import _VisualDVM.Passes.PassCode;
|
|
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 _VisualDVM.Visual.MainUI;
|
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
import java.io.File;
|
|
import java.util.Vector;
|
|
public class MainModule extends MainModule_<GlobalDatabase, MainUI> {
|
|
//--
|
|
Vector<PassCode> accountRoleDependentPasses = new Vector_<>(
|
|
PassCode.AddSubscriber,
|
|
PassCode.EditSubscriber,
|
|
PassCode.DeleteSubscriber,
|
|
PassCode.DeleteSubscriberWorkspace,
|
|
//--
|
|
PassCode.DownloadAllBugReportsArchives,
|
|
//--
|
|
PassCode.CompileServerSapfor,
|
|
PassCode.DeleteServerSapfor,
|
|
//
|
|
PassCode.ShutdownComponentsServer,
|
|
PassCode.StartComponentsServer,
|
|
PassCode.PublishComponentsServer,
|
|
//
|
|
PassCode.ShutdownTestingServer,
|
|
PassCode.StartTestingServer,
|
|
PassCode.PublishTestingServer
|
|
);
|
|
public MainModule() throws Exception {
|
|
super(GlobalDatabase.class, MainUI.class);
|
|
}
|
|
@Override
|
|
public Class getPassCodesEnum() {
|
|
return PassCode.class;
|
|
}
|
|
@Override
|
|
public String getAllPassesClassPrefix() {
|
|
return "_VisualDVM.Passes.All.";
|
|
}
|
|
//--
|
|
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 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 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);
|
|
}
|
|
public void SetUserPassesAccess() {
|
|
for (PassCode code : accountRoleDependentPasses)
|
|
getPass(code).setControlsVisible(false);
|
|
}
|
|
public void SetDeveloperPassesAccess() {
|
|
SetUserPassesAccess();
|
|
getPass(PassCode.DownloadAllBugReportsArchives).setControlsVisible(true);
|
|
}
|
|
public void SetAdminPassesAccess() {
|
|
for (PassCode code : accountRoleDependentPasses)
|
|
getPass(code).setControlsVisible(true);
|
|
}
|
|
//--
|
|
@Override
|
|
public int getFirstAccessPassesCount() {
|
|
return getDb().settings.get(SettingName.FastAccessPassesCount).toInt32();
|
|
}
|
|
}
|