промежуточный. перенос настроек в проект. есть баги. завтра доделываю, версия не вполне рабочая
This commit is contained in:
@@ -22,15 +22,11 @@ import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
|
||||
import _VisualDVM.GlobalData.SapforProfile.SapforProfilesDBTable;
|
||||
import _VisualDVM.GlobalData.SapforProfileSetting.SapforProfileSetting;
|
||||
import _VisualDVM.GlobalData.SapforProfileSetting.SapforProfileSettingsDBTable;
|
||||
import _VisualDVM.GlobalData.Settings.DBSetting;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.GlobalData.Settings.SettingsDBTable;
|
||||
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTasksDBTable;
|
||||
import _VisualDVM.GlobalData.Tasks.RunTask.RunTasksDBTable;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
import _VisualDVM.GlobalData.User.UsersDBTable;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
@@ -49,7 +45,6 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
public DVMParameterDBTable dvmParameters;
|
||||
public CredentialsDBTable credentials;
|
||||
//----- ДАННЫЕ ВИЗУАЛИЗАТОРА---------------------------------
|
||||
public SettingsDBTable settings;
|
||||
public LastProjectsDBTable lastProjects;
|
||||
public AccountsDBTable accounts;
|
||||
//-
|
||||
@@ -73,7 +68,6 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
addTable(runConfigurations = new RunConfigurationsDBTable());
|
||||
addTable(environmentValues = new EnvironmentValuesDBTable());
|
||||
addTable(credentials = new CredentialsDBTable());
|
||||
addTable(settings = new SettingsDBTable());
|
||||
addTable(lastProjects = new LastProjectsDBTable());
|
||||
addTable(accounts = new AccountsDBTable());
|
||||
addTable(dvmParameters = new DVMParameterDBTable());
|
||||
@@ -91,7 +85,6 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
credentials.Data.isEmpty() ? Insert(new Credentials()) :
|
||||
credentials.getFirstRecord());
|
||||
//настройки компонент
|
||||
settings.AddAll();
|
||||
runConfigurations.Patch();
|
||||
//---
|
||||
MainModule_.instance.getUI().getFastAccessMenuBar().Refresh();
|
||||
@@ -118,15 +111,19 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
}
|
||||
}
|
||||
//--
|
||||
public LinkedHashMap<SettingName, String> getSapforSettingsForProfile() {
|
||||
|
||||
public LinkedHashMap<String, String> getSapforSettingsForProfile() {
|
||||
/*
|
||||
LinkedHashMap<SettingName, String> res = new LinkedHashMap<>();
|
||||
for (DBSetting setting : settings.getSettingsByOwner(ComponentType.SapforOptions))
|
||||
if (setting.Visible)
|
||||
res.put(setting.Name, setting.Value);
|
||||
return res;
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
//проверить, есть ли профиль с таким же набором настроек.
|
||||
public SapforProfile checkProfileForCurrentSettings() {
|
||||
/*
|
||||
LinkedHashMap<SettingName, String> current_values = getSapforSettingsForProfile();
|
||||
for (SapforProfile profile : sapforProfiles.Data.values()) {
|
||||
//--получить все настройки профиля
|
||||
@@ -136,9 +133,11 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
//--
|
||||
if (current_values.equals(profileValues)) return profile;
|
||||
}
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
public void insertProfileSettings(SapforProfile profile) throws Exception {
|
||||
/*
|
||||
LinkedHashMap<SettingName, String> current_values = getSapforSettingsForProfile();
|
||||
for (SettingName name : current_values.keySet()) {
|
||||
//--
|
||||
@@ -149,6 +148,7 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
//--
|
||||
Insert(sapforProfileSetting);
|
||||
}
|
||||
*/
|
||||
}
|
||||
public void saveCurrentProfile(String name_in) throws Exception {
|
||||
if (checkProfileForCurrentSettings() == null) {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package _VisualDVM.GlobalData.SapforProfileSetting;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
public class SapforProfileSetting extends iDBObject {
|
||||
@Description("DEFAULT 'Undefined'")
|
||||
public SettingName name = SettingName.Undefined;
|
||||
public String name = "Undefined";
|
||||
@Description("DEFAULT ''")
|
||||
public String value = "";
|
||||
@Description("DEFAULT -1")
|
||||
|
||||
@@ -17,7 +17,7 @@ public class SapforProfileSettingsForm extends DataSetControlForm<SapforProfileS
|
||||
new ColumnInfo<SapforProfileSetting>("имя") {
|
||||
@Override
|
||||
public Object getFieldAt(SapforProfileSetting object) {
|
||||
return object.name.getDescription();
|
||||
return "?"; // object.name.getDescription();
|
||||
}
|
||||
},
|
||||
new ColumnInfo<SapforProfileSetting>("значение") {
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
package _VisualDVM.GlobalData.Settings;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Controls.StableMenuItem;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
public class DBSetting extends DBObject {
|
||||
@Description("PRIMARY KEY,UNIQUE")
|
||||
public SettingName Name;
|
||||
public String Value;
|
||||
public ComponentType Owner;
|
||||
@Description("IGNORE")
|
||||
public boolean Visible = true;
|
||||
@Description("IGNORE")
|
||||
public SettingType settingType = SettingType.Undefined;
|
||||
private JMenuItem menu_item = null;
|
||||
public DBSetting() {
|
||||
}
|
||||
public DBSetting(SettingName Name_,
|
||||
Object Value_,
|
||||
SettingType type_in,
|
||||
ComponentType owner_in,
|
||||
boolean Visible_in) {
|
||||
Name = Name_;
|
||||
Value = Value_.toString();
|
||||
settingType = type_in;
|
||||
Owner = owner_in;
|
||||
Visible = Visible_in;
|
||||
}
|
||||
public DBSetting(SettingName Name_, String Value_) {
|
||||
Name = Name_;
|
||||
Value = Value_;
|
||||
}
|
||||
public DBSetting(SettingName Name_,
|
||||
Object Value_,
|
||||
SettingType type_in,
|
||||
ComponentType owner_in
|
||||
) {
|
||||
this(Name_, Value_, type_in, owner_in, true);
|
||||
}
|
||||
public JMenuItem getMenuItem() {
|
||||
if (menu_item == null) {
|
||||
menu_item = new StableMenuItem(Name.getDescription());
|
||||
menu_item.addActionListener(new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Global.mainModule.getPass(PassCode.UpdateSetting).Do(Name);
|
||||
}
|
||||
});
|
||||
Mark();
|
||||
}
|
||||
return menu_item;
|
||||
}
|
||||
/*
|
||||
* булевского типа не надо. только 0 или 1
|
||||
*/
|
||||
//заводить разные типы настроек не надо.
|
||||
//иначе придется ковыряться с типами и таблицами в бд
|
||||
public void Mark() {
|
||||
switch (settingType) {
|
||||
case SapforFlag:
|
||||
getMenuItem().setIcon(Utils_.getIcon(toBoolean() ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
|
||||
break;
|
||||
case PercentField:
|
||||
getMenuItem().setText(Name.getDescription() + " : " + this + "%");
|
||||
break;
|
||||
case StringField:
|
||||
String valueToShow = Value.isEmpty() ? "не задано" : Utils_.Quotes(toString());
|
||||
getMenuItem().setText(Name.getDescription() + " : " + valueToShow);
|
||||
break;
|
||||
case IntField:
|
||||
getMenuItem().setText(Name.getDescription() + " : " + this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
public int toInt32() {
|
||||
return Integer.parseInt(Value);
|
||||
}
|
||||
public boolean toBoolean() {
|
||||
return toInt32() != 0;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return Value;
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package _VisualDVM.GlobalData.Settings;
|
||||
public enum SettingName {
|
||||
Undefined,
|
||||
//--------------
|
||||
Precompilation,
|
||||
SaveModifications, // сохранять исходную версию
|
||||
GCOVLimit,
|
||||
DVMConvertationOptions,
|
||||
//--
|
||||
//<editor-fold desc="Настройки сапфора. должны быть подряд!">
|
||||
STATIC_SHADOW_ANALYSIS,
|
||||
STATIC_PRIVATE_ANALYSIS,
|
||||
FREE_FORM,
|
||||
KEEP_DVM_DIRECTIVES,
|
||||
KEEP_SPF_DIRECTIVES,
|
||||
PARALLELIZE_FREE_LOOPS,
|
||||
MAX_SHADOW_WIDTH,
|
||||
OUTPUT_UPPER,
|
||||
TRANSLATE_MESSAGES,
|
||||
KEEP_LOOPS_CLOSE_NESTING,
|
||||
KEEP_GCOV,
|
||||
ANALYSIS_OPTIONS,
|
||||
DEBUG_PRINT_ON,
|
||||
MPI_PROGRAM,
|
||||
IGNORE_IO_SAPFOR,
|
||||
KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS,
|
||||
PARSE_FOR_INLINE,
|
||||
EMPTY_OPTION;
|
||||
public static SettingName getByDescription(String desc) {
|
||||
SettingName[] all = SettingName.values();
|
||||
for (SettingName settingName : all)
|
||||
if (desc.equals(settingName.getDescription())) return settingName;
|
||||
return Undefined;
|
||||
}
|
||||
public String getDescription() {
|
||||
switch (this) {
|
||||
case SaveModifications:
|
||||
return "Сохранять копию исходной версии при преобразованиях";
|
||||
case DVMConvertationOptions:
|
||||
return "Опции DVM конвертации";
|
||||
case GCOVLimit:
|
||||
return "Нижний порог отображения GCOV";
|
||||
case Precompilation:
|
||||
return "Предварительная компиляция";
|
||||
case STATIC_SHADOW_ANALYSIS:
|
||||
return "Оптимизация теневых обменов";
|
||||
case STATIC_PRIVATE_ANALYSIS:
|
||||
return "Статический анализ приватностей";
|
||||
case FREE_FORM:
|
||||
return "Свободный выходной стиль";
|
||||
case KEEP_DVM_DIRECTIVES:
|
||||
return "Учитывать DVM директивы";
|
||||
case KEEP_SPF_DIRECTIVES:
|
||||
return "Сохранять SPF директивы при построении параллельных вариантов";
|
||||
case PARALLELIZE_FREE_LOOPS:
|
||||
return "Улучшенное распараллеливание";
|
||||
case MAX_SHADOW_WIDTH:
|
||||
return "Максимальный размер теневых граней";
|
||||
case OUTPUT_UPPER:
|
||||
return "Верхний выходной регистр";
|
||||
case TRANSLATE_MESSAGES:
|
||||
return "Сообщения на русском языке";
|
||||
case KEEP_LOOPS_CLOSE_NESTING:
|
||||
return "Учитывать тесную вложенность циклов";
|
||||
case KEEP_GCOV:
|
||||
return "Учитывать GCOV";
|
||||
case ANALYSIS_OPTIONS:
|
||||
return "Опции анализа";
|
||||
case DEBUG_PRINT_ON:
|
||||
return "Включить отладочную печать";
|
||||
case MPI_PROGRAM:
|
||||
return "Общая память";
|
||||
case IGNORE_IO_SAPFOR:
|
||||
return "Игнорировать ввод/вывод";
|
||||
case KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS:
|
||||
return "Сохранять SPF директивы при преобразованиях";
|
||||
case PARSE_FOR_INLINE:
|
||||
return "Синтаксический анализ для подстановки";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
//</editor-fold>
|
||||
@@ -1,8 +0,0 @@
|
||||
package _VisualDVM.GlobalData.Settings;
|
||||
public enum SettingType {
|
||||
Undefined,
|
||||
SapforFlag,
|
||||
PercentField,
|
||||
StringField,
|
||||
IntField
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package _VisualDVM.GlobalData.Settings;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Repository.BugReport.Json.VisualiserSettingJson;
|
||||
import _VisualDVM.Repository.BugReport.Json.VisualiserSettingsJson;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import _VisualDVM.Utils;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
public class SettingsDBTable extends DBTable<SettingName, DBSetting> {
|
||||
public SettingsDBTable() {
|
||||
super(SettingName.class, DBSetting.class);
|
||||
}
|
||||
public void AddSetting(DBSetting s) throws Exception {
|
||||
if (containsKey(s.Name)) {
|
||||
DBSetting old = get(s.Name);
|
||||
old.settingType = s.settingType;
|
||||
old.Visible = s.Visible;
|
||||
//патч на всегда включить.
|
||||
if (s.Name.equals(SettingName.STATIC_PRIVATE_ANALYSIS) && !old.Value.equals("1")) {
|
||||
old.Value = "1";
|
||||
getDb().Update(s);
|
||||
}
|
||||
//---------------------------------------->>
|
||||
} else
|
||||
this.getDb().Insert(s);
|
||||
}
|
||||
//todo все загнать в Properties
|
||||
public void AddAll() throws Exception {
|
||||
//проверка списка всех настроек.
|
||||
//<editor-fold desc="Global">
|
||||
//</editor-fold>
|
||||
//--
|
||||
//<editor-fold desc="Sapfor">
|
||||
//при добавлении новых. учесть SapforTasksPackage (добавить поле)
|
||||
//и Global.packSapforSettings (добавить запаковку поля в конец)
|
||||
AddSetting(new DBSetting(SettingName.STATIC_SHADOW_ANALYSIS, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.STATIC_PRIVATE_ANALYSIS, 1, SettingType.SapforFlag, ComponentType.SapforOptions, false));
|
||||
AddSetting(new DBSetting(SettingName.FREE_FORM, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.KEEP_DVM_DIRECTIVES, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.KEEP_SPF_DIRECTIVES, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.PARALLELIZE_FREE_LOOPS, 0, SettingType.SapforFlag, ComponentType.SapforOptions, false));
|
||||
AddSetting(new DBSetting(SettingName.MAX_SHADOW_WIDTH, 50, SettingType.PercentField, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.OUTPUT_UPPER, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.TRANSLATE_MESSAGES, 1, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.KEEP_LOOPS_CLOSE_NESTING, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.KEEP_GCOV, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.ANALYSIS_OPTIONS, " ", SettingType.StringField, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.DEBUG_PRINT_ON, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.MPI_PROGRAM, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.IGNORE_IO_SAPFOR, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS, 1, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.PARSE_FOR_INLINE, 0, SettingType.SapforFlag, ComponentType.SapforOptions, false));
|
||||
//--> косвенные, анализам не передаются.
|
||||
AddSetting(new DBSetting(SettingName.Precompilation, 0, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.GCOVLimit, 10, SettingType.PercentField, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.DVMConvertationOptions, " ", SettingType.StringField, ComponentType.SapforOptions));
|
||||
AddSetting(new DBSetting(SettingName.SaveModifications, 1, SettingType.SapforFlag, ComponentType.SapforOptions));
|
||||
//</editor-fold>
|
||||
}
|
||||
public Vector<DBSetting> getSettingsByOwner(ComponentType owner) {
|
||||
return Data.values().stream().filter(setting -> setting.Owner.equals(owner)).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
public String getSapforSettingsText() {
|
||||
return "настройки SAPFOR\n" + String.join("\n",
|
||||
getSettingsByOwner(ComponentType.SapforOptions).stream().map(s -> " " + s.Name.getDescription() + "=" + s.Value).collect(Collectors.toCollection(Vector::new)));
|
||||
}
|
||||
public VisualiserSettingsJson getSapforSettingsJson() {
|
||||
VisualiserSettingsJson res = new VisualiserSettingsJson();
|
||||
Vector<DBSetting> sapforSettings = getSettingsByOwner(ComponentType.SapforOptions);
|
||||
for (DBSetting setting: sapforSettings){
|
||||
VisualiserSettingJson visualiserSettingJson = new VisualiserSettingJson(setting);
|
||||
res.array.add(visualiserSettingJson);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Linux;
|
||||
import Common.CommonConstants;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.GlobalData.Tasks.Supervisor.Local.LocalTaskSupervisor;
|
||||
|
||||
@@ -2,7 +2,6 @@ package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Windows;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Makefile.Makefile;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
|
||||
import _VisualDVM.GlobalData.Tasks.TaskState;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package _VisualDVM.GlobalData.Tasks.Supervisor;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Tasks.Task;
|
||||
|
||||
Reference in New Issue
Block a user