Source:
<code>void updatePrimaryStar() { if (_env == null || !OTOptions.isEditable(_obsComp.getProgram(), _obsComp.getContextObservation())) return; final TargetEnvironment env = _dataObject.getTargetEnvironment(); final Option<SPTarget> targetOpt = getSelectedPos(); final Option<IndexedGuideGroup> iggOpt = targetOpt.flatMap(this::getTargetGroup).orElse(getSelectedGroup()); final boolean primaryGroupIsSelected = iggOpt.exists(igg -> igg.group().equals(env.getPrimaryGuideGroup())); iggOpt.foreach(igg -> { final GuideGroup primary = env.getPrimaryGuideGroup(); ImOption.apply(env.getGuideEnvironment()).foreach(ge -> { final GuideGrp grp = igg.group().grp(); <START> if (ge != null && grp instanceof AutomaticGroup.Disabled$) { <END> final TargetEnvironment envNew = env.setGuideEnvironment(ge.setAutomaticGroup(GuideGroup.AutomaticInitial()).setPrimaryIndex(0)); _dataObject.setTargetEnvironment(envNew); _model.enableAutoRow(envNew); } else if (ge != null && primary != igg.group() && confirmGroupChange(primary, igg.group())) { _dataObject.setTargetEnvironment(env.setGuideEnvironment(ge.setPrimaryIndex(igg.index()))); if (grp instanceof AutomaticGroup.Active) { updatePosAngle(((AutomaticGroup.Active) grp).posAngle()); } } }); }); final boolean autoGroup = targetOpt.flatMap(this::getTargetGroup).exists(igg -> igg.group().isAutomatic()); if (!autoGroup) { targetOpt.foreach(target -> { if (primaryGroupIsSelected || iggOpt.exists(igg -> igg.group().getAllContaining(target).forall(gpt -> gpt.getPrimary().forall(pt -> pt != target)))) { PrimaryTargetToggle.instance.toggle(_dataObject, target); } }); } }</code><technical_language>I guess ge null if ImOption</technical_language>

Target:
void updatePrimaryStar() { if (_env == null || !OTOptions.isEditable(_obsComp.getProgram(), _obsComp.getContextObservation())) return; final TargetEnvironment env = _dataObject.getTargetEnvironment(); final Option<SPTarget> targetOpt = getSelectedPos(); final Option<IndexedGuideGroup> iggOpt = targetOpt.flatMap(this::getTargetGroup).orElse(getSelectedGroup()); final boolean primaryGroupIsSelected = iggOpt.exists(igg -> igg.group().equals(env.getPrimaryGuideGroup())); iggOpt.foreach(igg -> { final GuideGroup primary = env.getPrimaryGuideGroup(); ImOption.apply(env.getGuideEnvironment()).foreach(ge -> { final GuideGrp grp = igg.group().grp(); if (grp instanceof AutomaticGroup.Disabled$) { final TargetEnvironment envNew = env.setGuideEnvironment(ge.setAutomaticGroup(GuideGroup.AutomaticInitial()).setPrimaryIndex(0)); _dataObject.setTargetEnvironment(envNew); _model.enableAutoRow(envNew); } else if (primary != igg.group() && confirmGroupChange(primary, igg.group())) { _dataObject.setTargetEnvironment(env.setGuideEnvironment(ge.setPrimaryIndex(igg.index()))); if (grp instanceof AutomaticGroup.Active) { updatePosAngle(((AutomaticGroup.Active) grp).posAngle()); } } }); }); final boolean autoGroup = targetOpt.flatMap(this::getTargetGroup).exists(igg -> igg.group().isAutomatic()); if (!autoGroup) { targetOpt.foreach(target -> { if (primaryGroupIsSelected || iggOpt.exists(igg -> igg.group().getAllContaining(target).forall(gpt -> gpt.getPrimary().forall(pt -> pt != target)))) { PrimaryTargetToggle.instance.toggle(_dataObject, target); } }); } }