no message
This commit is contained in:
63
src/_VisualDVM/Passes/All/UpdateProperty.java
Normal file
63
src/_VisualDVM/Passes/All/UpdateProperty.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalProperties;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
public class UpdateProperty extends Pass<Object> {
|
||||
//todo в дальнейшем, все настройки перевести в properties, и перенести сюда функционал UpdateSetting (?)
|
||||
String name = "";
|
||||
Field field = null;
|
||||
Object oldValue = null;
|
||||
Object newValue = null;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
name = (String) args[0];
|
||||
newValue = args[1];
|
||||
//--
|
||||
field = GlobalProperties.class.getField(name);
|
||||
oldValue = field.get(Global.properties);
|
||||
//---
|
||||
return !newValue.equals(oldValue);
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
field.set(Global.properties, newValue);
|
||||
Global.properties.Update();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
switch (name) {
|
||||
case "collapseCredentials":
|
||||
if ((boolean) newValue)
|
||||
UI.getMainWindow().getTestingWindow().CollapseCredentials();
|
||||
else
|
||||
UI.getMainWindow().getTestingWindow().ExpandCredentials();
|
||||
break;
|
||||
case "collapseProjectTrees":
|
||||
if (Global.mainModule.HasProject()) {
|
||||
if ((boolean) newValue)
|
||||
UI.getMainWindow().getProjectWindow().CollapseProjectTrees();
|
||||
else UI.getMainWindow().getProjectWindow().ExpandProjectTrees();
|
||||
}
|
||||
break;
|
||||
case "collapseFileGraphs":
|
||||
if (Global.mainModule.HasFile()) {
|
||||
if ((boolean) newValue)
|
||||
Global.mainModule.getFile().form.CollapseGraphs();
|
||||
else
|
||||
Global.mainModule.getFile().form.ExpandGraphs();
|
||||
}
|
||||
break;
|
||||
case "collapseFileMessages":
|
||||
if (Global.mainModule.HasFile()) {
|
||||
if ((boolean) newValue)
|
||||
Global.mainModule.getFile().form.CollapseMessages();
|
||||
else
|
||||
Global.mainModule.getFile().form.ExpandMessages();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user