no message
This commit is contained in:
5
.idea/workspace.xml
generated
5
.idea/workspace.xml
generated
@@ -9,12 +9,7 @@
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Settings/SettingName.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Settings/SettingName.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Settings/SettingsDBTable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Settings/SettingsDBTable.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalProperties.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalProperties.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteDownloadedBugReports.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DeleteDownloadedBugReports.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/GetOldBugReports.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/GetOldBugReports.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/UpdateSetting.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/UpdateSetting.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainMenuBar/VisualiserSettingsMenu/VisualiserSettingsMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainMenuBar/VisualiserSettingsMenu/VisualiserSettingsMenu.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
||||
@@ -48,5 +48,5 @@
|
||||
"FortranWrapsOn": false,
|
||||
"ExtensionsOn": false,
|
||||
"ComparsionDiffMergeOn": true,
|
||||
"BugReportsAgeLimit": 3
|
||||
"BugReportsAgeLimit": 6
|
||||
}
|
||||
@@ -7,10 +7,14 @@ import _VisualDVM.Passes.PassCode;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.LinkedHashMap;
|
||||
public class GlobalProperties {
|
||||
LinkedHashMap<String,JMenuItem> controls= new LinkedHashMap<>();
|
||||
@Expose
|
||||
public _VisualDVM.Mode Mode = _VisualDVM.Mode.Normal;
|
||||
@Expose
|
||||
@@ -274,24 +278,87 @@ public class GlobalProperties {
|
||||
});
|
||||
menu.add(menu_item);
|
||||
}
|
||||
public void addIntSliderMenuItem(JMenu menu, String fieldName, int min, int max) {
|
||||
public Object getValue(String fieldName){
|
||||
Object res=null;
|
||||
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);
|
||||
res = this.getClass().getField(fieldName).get(this);
|
||||
}
|
||||
catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//создать контрол
|
||||
public JMenuItem getMenuItem(String fieldName){
|
||||
final JMenuItem menuItem;
|
||||
if (controls.containsKey(fieldName))
|
||||
menuItem = controls.get(fieldName);
|
||||
else {
|
||||
menuItem = new StableMenuItem();
|
||||
Mark(fieldName,menuItem);
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (fieldName){
|
||||
case "BugReportsAgeLimit":
|
||||
SliderNumberForm f = new SliderNumberForm();
|
||||
if (f.ShowDialog(getFieldDescription(fieldName), getValue(fieldName), 1, 12)) {
|
||||
int newValue = f.Result;
|
||||
if (Global.mainModule.getPass(PassCode.UpdateProperty).Do(fieldName, newValue)) {
|
||||
Mark(fieldName, menuItem);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
menu.add(menu_item);
|
||||
} catch (Exception ex) {
|
||||
controls.put(fieldName,menuItem);
|
||||
}
|
||||
return menuItem;
|
||||
}
|
||||
//отобразить на контроле значение поля.
|
||||
public void Mark(String fieldName, JMenuItem control){
|
||||
String description= getFieldDescription(fieldName);
|
||||
try {
|
||||
Object value = this.getClass().getField(fieldName).get(this);
|
||||
if (value instanceof Boolean){
|
||||
Boolean flag = (Boolean) value;
|
||||
control.setText(description);
|
||||
control.setIcon(Utils_.getIcon(flag? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
|
||||
}else {
|
||||
control.setText(description+" : "+value);
|
||||
}
|
||||
}
|
||||
catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
/*
|
||||
public ActionListener getChangeAction(String fieldName){
|
||||
try {
|
||||
String description = getFieldDescription(fieldName);
|
||||
Object oldValue = this.getClass().getField(fieldName).get(this);
|
||||
return new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (fieldName) {
|
||||
case "BugReportsAgeLimit":
|
||||
SliderNumberForm f = new SliderNumberForm();
|
||||
if (f.ShowDialog(description, oldValue, 1, 12)) {
|
||||
int newValue = f.Result;
|
||||
if (Global.mainModule.getPass(PassCode.UpdateProperty).Do(fieldName, newValue)) {
|
||||
menu_item.setText(description + " : " + newValue);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ public class VisualiserSettingsMenu extends VisualiserMenu {
|
||||
add(new SynchronizationSettingsMenu());
|
||||
add(new VersionsComparisonMenu());
|
||||
add((Global.mainModule.getDb()).settings.get(SettingName.Workspace).getMenuItem());
|
||||
Global.properties.addIntSliderMenuItem(this, "BugReportsAgeLimit",1,12);
|
||||
add(Global.properties.getMenuItem("BugReportsAgeLimit"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user