галочка для назначения профиля по умолчанию
This commit is contained in:
37
src/_VisualDVM/Passes/All/SetDefaultSapforProfile.java
Normal file
37
src/_VisualDVM/Passes/All/SetDefaultSapforProfile.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
|
||||
import _VisualDVM.Utils;
|
||||
|
||||
import java.util.Vector;
|
||||
public class SetDefaultSapforProfile extends Pass<SapforProfile> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (SapforProfile) args[0];
|
||||
return UI.Question("Назначить профиль "+ Utils_.Brackets(target.description)+" профилем по умолчанию");
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Vector<SapforProfile> toDrop = new Vector<>();
|
||||
for (SapforProfile sapforProfile : Global.mainModule.getDb().sapforProfiles.Data.values()) {
|
||||
if (sapforProfile.id!=target.id) {
|
||||
if (sapforProfile.isAuto != 0) {
|
||||
sapforProfile.isAuto = 0;
|
||||
toDrop.add(sapforProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (SapforProfile sapforProfile : toDrop)
|
||||
Global.mainModule.getDb().Update(sapforProfile);
|
||||
//--
|
||||
target.SwitchAuto();
|
||||
Global.mainModule.getDb().Update(target);
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
Global.mainModule.getDb().sapforProfiles.getUI().RedrawControl();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user