рефакторинг. переносил текущие объекты в другое место
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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("?");
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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("Выбрать всё для " +
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user