2024-10-09 22:01:19 +03:00
|
|
|
|
package _VisualDVM.Visual.Menus.MainMenuBar;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import Common.Passes.Pass;
|
|
|
|
|
|
import Common.Visual.Controls.MenuBarButton;
|
2024-12-02 23:11:40 +03:00
|
|
|
|
import Common.Visual.Fonts.VisualiserFonts;
|
2024-10-14 20:57:18 +03:00
|
|
|
|
import Common.Visual.Menus.VisualiserMenuBar;
|
2024-10-15 15:13:57 +03:00
|
|
|
|
import Common.Visual.UI;
|
2025-02-18 16:21:20 +03:00
|
|
|
|
import _VisualDVM.ComponentsServer.Component.PerformanceAnalyzer.PerformanceAnalyzer;
|
2024-10-07 00:58:29 +03:00
|
|
|
|
import _VisualDVM.Global;
|
2024-12-02 23:11:40 +03:00
|
|
|
|
import _VisualDVM.GlobalData.Compiler.Compiler;
|
|
|
|
|
|
import _VisualDVM.GlobalData.Machine.Machine;
|
|
|
|
|
|
import _VisualDVM.GlobalData.User.User;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import _VisualDVM.Passes.PassCode;
|
2024-10-09 22:01:19 +03:00
|
|
|
|
import _VisualDVM.Visual.Menus.MainMenuBar.VisualiserSettingsMenu.VisualiserSettingsMenu;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
|
import java.awt.*;
|
2024-12-02 23:11:40 +03:00
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
|
|
import java.awt.event.ActionListener;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public class MainMenuBar extends VisualiserMenuBar {
|
2024-12-02 23:11:40 +03:00
|
|
|
|
public MenuBarButton MachineButton;
|
|
|
|
|
|
public MenuBarButton UserButton;
|
|
|
|
|
|
public MenuBarButton CompilerButton;
|
2025-03-13 00:32:20 +03:00
|
|
|
|
JMenu analyses;
|
|
|
|
|
|
JMenu transformations;
|
|
|
|
|
|
MenuBarButton componentsButton;
|
|
|
|
|
|
ActionListener credentialsListener = new ActionListener() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
|
Global.mainModule.getUI().getMainWindow().FocusCredentials();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public MainMenuBar() {
|
|
|
|
|
|
addMenus(new LastOpenedProjectsMenu());
|
2024-10-09 23:37:58 +03:00
|
|
|
|
addPasses(PassCode.OpenCurrentProject, PassCode.CreateEmptyProject);
|
2023-09-17 22:13:42 +03:00
|
|
|
|
addMenus(
|
|
|
|
|
|
analyses = new AnalysesMenu(),
|
|
|
|
|
|
transformations = new TransformationsMenu(),
|
|
|
|
|
|
new GlobalCleaningMenu(),
|
|
|
|
|
|
new VisualiserSettingsMenu()
|
|
|
|
|
|
);
|
2024-10-22 20:16:57 +03:00
|
|
|
|
add(componentsButton = new MenuBarButton() {
|
2023-09-17 22:13:42 +03:00
|
|
|
|
{
|
|
|
|
|
|
setToolTipText("Компоненты");
|
|
|
|
|
|
setIcon("/icons/ComponentsActual.png");
|
|
|
|
|
|
addActionListener(e -> {
|
|
|
|
|
|
if (PerformanceAnalyzer.isActive) {
|
2024-10-15 15:13:57 +03:00
|
|
|
|
UI.Info("Перед работой с компонентами закройте анализатор производительности!");
|
2023-09-17 22:13:42 +03:00
|
|
|
|
} else {
|
2024-10-13 23:55:03 +03:00
|
|
|
|
Global.mainModule.getPass(PassCode.GetComponentsActualVersions).Do();
|
2024-10-22 20:18:50 +03:00
|
|
|
|
Global.components.refreshUpdatesStatus();
|
2024-10-15 02:32:52 +03:00
|
|
|
|
Global.mainModule.getUI().getComponentsWindow().ShowDialog("");
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
add(new MenuBarButton() {
|
|
|
|
|
|
{
|
|
|
|
|
|
setIcon("/icons/Comparsion.png");
|
|
|
|
|
|
setToolTipText("Анализатор статистик");
|
|
|
|
|
|
addActionListener(e -> {
|
|
|
|
|
|
Global.performanceAnalyzer.Start();
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2024-10-09 23:37:58 +03:00
|
|
|
|
addPasses(PassCode.ShowInstruction);
|
2023-09-17 22:13:42 +03:00
|
|
|
|
//-
|
|
|
|
|
|
setPreferredSize(new Dimension(0, 30));
|
2025-02-11 21:28:35 +03:00
|
|
|
|
//--
|
2025-03-24 14:50:54 +03:00
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-17 22:13:42 +03:00
|
|
|
|
add(new MenuBarButton() {
|
|
|
|
|
|
{
|
2024-10-15 16:58:20 +03:00
|
|
|
|
setIcon("/Common/icons/Apply.png");
|
2023-09-17 22:13:42 +03:00
|
|
|
|
setToolTipText("Test");
|
|
|
|
|
|
addActionListener(e -> {
|
2024-10-13 23:55:03 +03:00
|
|
|
|
Global.mainModule.getPass(PassCode.TestPass).Do();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-03-24 14:50:54 +03:00
|
|
|
|
*/
|
2025-02-11 21:28:35 +03:00
|
|
|
|
//--
|
2024-12-02 23:11:40 +03:00
|
|
|
|
add(new JSeparator());
|
|
|
|
|
|
add(MachineButton = new MenuBarButton() {
|
|
|
|
|
|
{
|
|
|
|
|
|
setIcon("/icons/Machine.png");
|
|
|
|
|
|
setFont(VisualiserFonts.TreeBold);
|
|
|
|
|
|
setToolTipText("Текущая машина");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//--
|
|
|
|
|
|
add(UserButton = new MenuBarButton() {
|
|
|
|
|
|
{
|
|
|
|
|
|
setIcon("/icons/User.png");
|
|
|
|
|
|
setFont(VisualiserFonts.TreeBold);
|
|
|
|
|
|
setToolTipText("Текущий пользователь");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
add(CompilerButton = new MenuBarButton() {
|
|
|
|
|
|
{
|
|
|
|
|
|
setIcon("/icons/type.png");
|
|
|
|
|
|
setFont(VisualiserFonts.TreeBold);
|
|
|
|
|
|
setToolTipText("Текущий компилятор");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
MachineButton.addActionListener(credentialsListener);
|
|
|
|
|
|
UserButton.addActionListener(credentialsListener);
|
|
|
|
|
|
CompilerButton.addActionListener(credentialsListener);
|
2023-09-17 22:13:42 +03:00
|
|
|
|
ShowProject(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowUpdatesIcon() {
|
2024-10-22 20:16:57 +03:00
|
|
|
|
componentsButton.setIcon(Global.components.getButtonIconPath());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
public void ShowProject(boolean flag) {
|
|
|
|
|
|
analyses.setEnabled(flag);
|
|
|
|
|
|
transformations.setEnabled(flag);
|
2024-10-09 23:37:58 +03:00
|
|
|
|
Pass[] cleaningPasses = new Pass[]{
|
2024-10-13 23:55:03 +03:00
|
|
|
|
Global.mainModule.getPass(PassCode.DropAnalyses),
|
|
|
|
|
|
Global.mainModule.getPass(PassCode.DropSavedArrays),
|
|
|
|
|
|
Global.mainModule.getPass(PassCode.CleanAnalyses),
|
|
|
|
|
|
Global.mainModule.getPass(PassCode.DeleteDebugResults),
|
|
|
|
|
|
Global.mainModule.getPass(PassCode.ResetCurrentProject)
|
2023-09-17 22:13:42 +03:00
|
|
|
|
};
|
2024-10-09 23:37:58 +03:00
|
|
|
|
for (Pass pass : cleaningPasses) {
|
2023-09-17 22:13:42 +03:00
|
|
|
|
pass.setControlsEnabled(flag);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-02 23:11:40 +03:00
|
|
|
|
public void ShowMachine(Machine machine) {
|
|
|
|
|
|
MachineButton.setText(machine.getURL());
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowUser(User user) {
|
|
|
|
|
|
UserButton.setText(user.login);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowCompiler(Compiler compiler) {
|
|
|
|
|
|
CompilerButton.setText(compiler.description);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowNoMachine() {
|
|
|
|
|
|
MachineButton.setText("?");
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowNoUser() {
|
|
|
|
|
|
UserButton.setText("?");
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowNoCompiler() {
|
|
|
|
|
|
CompilerButton.setText("?");
|
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|