промежуточный. в процессе рефакторинга настроек.
This commit is contained in:
@@ -2,6 +2,7 @@ package _VisualDVM;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Controls.StableMenuItem;
|
||||
import Common.Visual.Windows.Dialog.SliderNumberForm;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
@@ -98,17 +99,19 @@ public class GlobalProperties {
|
||||
public int lastCompilerId = CommonConstants.Nan;
|
||||
//--
|
||||
@Expose
|
||||
public boolean RegisterOn=false;
|
||||
public boolean RegisterOn = false;
|
||||
@Expose
|
||||
public boolean SpacesOn=false;
|
||||
public boolean SpacesOn = false;
|
||||
@Expose
|
||||
public boolean EmptyLinesOn=false;
|
||||
public boolean EmptyLinesOn = false;
|
||||
@Expose
|
||||
public boolean FortranWrapsOn=false;
|
||||
public boolean FortranWrapsOn = false;
|
||||
@Expose
|
||||
public boolean ExtensionsOn=false;
|
||||
public boolean ExtensionsOn = false;
|
||||
@Expose
|
||||
public boolean ComparsionDiffMergeOn=false;
|
||||
public boolean ComparsionDiffMergeOn = false;
|
||||
@Expose
|
||||
public int BugReportsAgeLimit = 2;
|
||||
public GlobalProperties(GlobalProperties p) {
|
||||
super();
|
||||
Mode = p.Mode;
|
||||
@@ -160,6 +163,8 @@ public class GlobalProperties {
|
||||
//-----------------
|
||||
public String getFieldDescription(String fieldName) {
|
||||
switch (fieldName) {
|
||||
case "BugReportsAgeLimit":
|
||||
return "Срок хранения отчетов об ошибках (месяцы)";
|
||||
case "ExtensionsOn":
|
||||
return "Учитывать расширения файлов";
|
||||
case "FortranWrapsOn":
|
||||
@@ -197,16 +202,6 @@ public class GlobalProperties {
|
||||
}
|
||||
}
|
||||
//-----------------
|
||||
public void addFlagMenuItem(JMenu menu, String fieldName) {
|
||||
JMenuItem menu_item = new StableMenuItem(getFieldDescription(fieldName),
|
||||
getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png");
|
||||
//-
|
||||
menu_item.addActionListener(e -> {
|
||||
if (Global.mainModule.getPass(PassCode.UpdateProperty).Do(fieldName, !getFlag(fieldName)))
|
||||
menu_item.setIcon(Utils_.getIcon(getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
|
||||
});
|
||||
menu.add(menu_item);
|
||||
}
|
||||
public boolean getFlag(String fieldName) {
|
||||
boolean field = false;
|
||||
try {
|
||||
@@ -268,4 +263,35 @@ public class GlobalProperties {
|
||||
public File getFile() {
|
||||
return Paths.get(System.getProperty("user.dir"), "properties").toFile();
|
||||
}
|
||||
//-----------------
|
||||
public void addFlagMenuItem(JMenu menu, String fieldName) {
|
||||
JMenuItem menu_item = new StableMenuItem(getFieldDescription(fieldName),
|
||||
getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png");
|
||||
//-
|
||||
menu_item.addActionListener(e -> {
|
||||
if (Global.mainModule.getPass(PassCode.UpdateProperty).Do(fieldName, !getFlag(fieldName)))
|
||||
menu_item.setIcon(Utils_.getIcon(getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
|
||||
});
|
||||
menu.add(menu_item);
|
||||
}
|
||||
public void addIntSliderMenuItem(JMenu menu, String fieldName, int min, int max) {
|
||||
try {
|
||||
String description = getFieldDescription(fieldName);
|
||||
Object oldValue = this.getClass().getField(fieldName).get(this);
|
||||
JMenuItem menu_item = new StableMenuItem(description + " : " + oldValue);
|
||||
//-
|
||||
menu_item.addActionListener(e -> {
|
||||
SliderNumberForm f = new SliderNumberForm();
|
||||
if (f.ShowDialog(description, oldValue, min, max)) {
|
||||
int newValue = f.Result;
|
||||
if (Global.mainModule.getPass(PassCode.UpdateProperty).Do(fieldName, newValue)) {
|
||||
menu_item.setText(description + " : " + newValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
menu.add(menu_item);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user