2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-09 23:37:58 +03:00
|
|
|
import Common.Current_;
|
2024-10-08 01:30:25 +03:00
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Current;
|
2024-10-09 22:21:57 +03:00
|
|
|
import _VisualDVM.GlobalData.GlobalDatabase;
|
|
|
|
|
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
|
|
|
|
|
import _VisualDVM.GlobalData.SapforProfileSetting.SapforProfileSetting;
|
2024-10-09 23:37:58 +03:00
|
|
|
import Visual_DVM_2021.Passes.PassCode;
|
2024-10-10 23:57:36 +03:00
|
|
|
import Common.Passes.Pass;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
import java.util.Vector;
|
2024-10-09 23:37:58 +03:00
|
|
|
public class ApplyProfile extends Pass<SapforProfile> {
|
2023-09-17 22:13:42 +03:00
|
|
|
@Override
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
return "/icons/Apply.png";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public boolean needsConfirmations() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2024-10-09 23:37:58 +03:00
|
|
|
if (Current_.Check(Log, Current.SapforProfile)) {
|
|
|
|
|
target = (SapforProfile) Current_.get(Current.SapforProfile);
|
2023-09-17 22:13:42 +03:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void body() throws Exception {
|
|
|
|
|
Vector<SapforProfileSetting> settings = new Vector<>();
|
2024-10-08 01:30:25 +03:00
|
|
|
for (SapforProfileSetting sapforProfileSetting : ((GlobalDatabase)CommonUtils.db).sapforProfilesSettings.Data.values())
|
2023-09-17 22:13:42 +03:00
|
|
|
if (sapforProfileSetting.sapforprofile_id == target.id)
|
|
|
|
|
settings.add(sapforProfileSetting);
|
|
|
|
|
//--
|
|
|
|
|
for (SapforProfileSetting setting : settings)
|
2024-10-08 01:30:25 +03:00
|
|
|
if (((GlobalDatabase)CommonUtils.db).settings.containsKey(setting.name))
|
2024-10-09 23:37:58 +03:00
|
|
|
passes.get(PassCode.UpdateSetting).Do(setting.name, setting.value);
|
2023-09-17 22:13:42 +03:00
|
|
|
//--
|
|
|
|
|
}
|
|
|
|
|
}
|